Skip to content

Commit

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

* fix: Handle peers with zero messages when printing status

* Add changeset
  • Loading branch information
sanjayprabhu authored and bhgomes committed Jun 15, 2023
1 parent c8f7ea9 commit e07efaa
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 e07efaa

Please sign in to comment.