Skip to content

Commit

Permalink
fix: Handle peers with zero messages when printing status (#1008)
Browse files Browse the repository at this point in the history
* fix: Handle peers with zero messages when printing status

* Add changeset
  • Loading branch information
sanjayprabhu authored Jun 5, 2023
1 parent 398caa4 commit 6667748
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/curvy-hotels-joke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@farcaster/hubble': patch
---

Handle peers with no messages in status command
3 changes: 3 additions & 0 deletions apps/hubble/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,9 @@ app
let isSyncing = false;
const msgPercents: number[] = [];
for (const peerStatus of syncResult.value.syncStatus) {
if (peerStatus.theirMessages === 0) {
continue;
}
const messagePercent = (peerStatus.ourMessages / peerStatus.theirMessages) * 100;
msgPercents.push(messagePercent);
if (syncResult.value.isSyncing) {
Expand Down

0 comments on commit 6667748

Please sign in to comment.