Skip to content

Commit

Permalink
fix: new connection issue notification text and log less (#1563)
Browse files Browse the repository at this point in the history
  • Loading branch information
tyleroooo authored Mar 7, 2025
1 parent 9e00e27 commit 1665904
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 11 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"@datadog/browser-logs": "^5.23.3",
"@dydxprotocol/v4-abacus": "1.13.39",
"@dydxprotocol/v4-client-js": "1.19.0",
"@dydxprotocol/v4-localization": "^1.1.267",
"@dydxprotocol/v4-localization": "^1.1.269",
"@dydxprotocol/v4-proto": "^7.0.0-dev.0",
"@emotion/is-prop-valid": "^1.3.0",
"@funkit/connect": "^5.0.1",
Expand Down
8 changes: 4 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 13 additions & 4 deletions src/bonsai/calculators/apiState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ export function getLatestHeight(heightState: HeightState): HeightResponse | unde
return heightState.lastFewResults.find((s) => s.data?.response != null)?.data?.response;
}

let lastLoggedStatus: ApiStatus | undefined;

export function computeApiState(heights: {
indexerHeight: HeightState;
validatorHeight: HeightState;
Expand Down Expand Up @@ -161,12 +163,19 @@ export function computeApiState(heights: {
indexerHeight: indexerHeight?.height,
validatorHeight: validatorHeight?.height,
};

if (result.status !== ApiStatus.NORMAL) {
logBonsaiInfo('ComputeApiStatus', 'Computed non-normal status', {
...result,
rawHeights: heights,
});
if (result.status !== lastLoggedStatus) {
lastLoggedStatus = result.status;
logBonsaiInfo('ComputeApiStatus', 'Computed non-normal status', {
...result,
rawHeights: heights,
});
}
} else {
lastLoggedStatus = undefined;
}

return result;
}

Expand Down
4 changes: 2 additions & 2 deletions src/hooks/useApiState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ export enum ConnectionErrorType {

const ErrorMessageMap = {
[ConnectionErrorType.CHAIN_DISRUPTION]: {
title: STRING_KEYS.CHAIN_DISRUPTION_DETECTED,
body: STRING_KEYS.CHAIN_DISRUPTION_DETECTED_BODY,
title: STRING_KEYS.CONNECTION_ISSUE_DETECTED,
body: STRING_KEYS.CONNECTION_ISSUE_DETECTED_BODY,
},
[ConnectionErrorType.INDEXER_TRAILING]: {
title: STRING_KEYS.ORDERBOOK_LAGGING,
Expand Down

0 comments on commit 1665904

Please sign in to comment.