Skip to content
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.

Commit

Permalink
🐛 Fix logic api client healthcheck logic
Browse files Browse the repository at this point in the history
  • Loading branch information
sameersubudhi committed Jan 8, 2024
1 parent 958d3c1 commit aaba729
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions services/blockchain-connector/shared/sdk/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ const pingListener = apiClient => {
clearTimeout(apiClient.pingTimeout);

apiClient.pingTimeout = setTimeout(() => {
// Do not reset if the ping was delayed and just received
const timeSinceLastPing = now - apiClient.lastPingAt;
if (timeSinceLastPing) {
// Inside this callback, `now` refers to the time when the previous ping was received and this instance of timeout was set
const timeSinceLastPing = Date.now() - now;
if (timeSinceLastPing - WS_SERVER_PING_THRESHOLD > 0) {
logger.warn(
`No ping for client ${apiClient.poolIndex} from server in ${timeSinceLastPing}ms (last ping: ${apiClient.lastPingAt}).`,
);
Expand Down

0 comments on commit aaba729

Please sign in to comment.