Skip to content

Commit 8f4e8e4

Browse files
authored
fix: make the contact info logs for the sync health job richer (#2338)
It's currently hard to tell what state the contact info is in if the rpc address is not present. Differentiate the error states better in the logging. ## Merge Checklist _Choose all relevant options below by adding an `x` now or at any time before submitting for review_ - [x] PR title adheres to the [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) standard - [ ] PR has a [changeset](https://github.com/farcasterxyz/hub-monorepo/blob/main/CONTRIBUTING.md#35-adding-changesets) - [x] PR has been tagged with a change label(s) (i.e. documentation, feature, bugfix, or chore) - [ ] PR includes [documentation](https://github.com/farcasterxyz/hub-monorepo/blob/main/CONTRIBUTING.md#32-writing-docs) if necessary. <!-- start pr-codex --> --- ## PR-Codex overview This PR focuses on improving error handling and simplifying the return values related to `contactInfo` in the `syncHealthJob.ts` file. ### Detailed summary - Replaced returning `undefined` when `contactInfo` is missing with returning the string `"Missing contact info"`. - Changed the return value for `contactInfo` to directly return `contactInfo.contactInfo`. - Updated the error message to exclude `contactInfo` details in the logging. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` <!-- end pr-codex -->
1 parent 12e8c05 commit 8f4e8e4

File tree

1 file changed

+5
-15
lines changed

1 file changed

+5
-15
lines changed

apps/hubble/src/network/sync/syncHealthJob.ts

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -181,23 +181,12 @@ export class MeasureSyncHealthJobScheduler {
181181
const contactInfo = this._metadataRetriever._syncEngine.getContactInfoForPeerId(peer.identifier);
182182

183183
if (!contactInfo) {
184-
return undefined;
185-
}
186-
187-
const rpcAddress = contactInfo.contactInfo.rpcAddress;
188-
if (rpcAddress) {
189-
const addressInfo = addressInfoFromGossip(rpcAddress);
190-
191-
if (addressInfo.isErr()) {
192-
return undefined;
193-
}
194-
195-
return addressInfoToString(addressInfo.value);
184+
return "Missing contact info";
196185
}
197186

198-
return contactInfo;
187+
return contactInfo.contactInfo;
199188
} else {
200-
return undefined;
189+
return peer.identifier;
201190
}
202191
}
203192

@@ -235,8 +224,9 @@ export class MeasureSyncHealthJobScheduler {
235224
{
236225
peerId: peer.identifier,
237226
err: syncHealthMessageStats.error,
227+
contactInfo,
238228
},
239-
`Error computing SyncHealth: ${syncHealthMessageStats.error}. Contact info: ${contactInfo}`,
229+
`Error computing SyncHealth: ${syncHealthMessageStats.error}.`,
240230
);
241231
continue;
242232
}

0 commit comments

Comments
 (0)