Skip to content

Commit

Permalink
fix(Nodes): check health only for enabled node
Browse files Browse the repository at this point in the history
  • Loading branch information
bludnic committed Nov 2, 2023
1 parent 5dc28ab commit a217a50
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions src/lib/nodes/abstract.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,17 +110,22 @@ export abstract class Node<C = unknown> {

async startHealthcheck() {
clearInterval(this.timer)
try {
const health = await this.checkHealth()

this.height = health.height
this.ping = health.ping
this.online = true
} catch (err) {
this.online = false

// Check health only for enabled nodes
if (this.active) {
try {
const health = await this.checkHealth()

this.height = health.height
this.ping = health.ping
this.online = true
} catch (err) {
this.online = false
}

this.fireStatusChange()
}

this.fireStatusChange()
this.timer = setTimeout(() => this.startHealthcheck(), REVISE_CONNECTION_TIMEOUT)
}

Expand Down

0 comments on commit a217a50

Please sign in to comment.