Skip to content
This repository was archived by the owner on Jul 21, 2023. It is now read-only.

Commit 843fe61

Browse files
committed
fix: only start self-query if node is not stopped
Also only schedule next self-query if node is still running.
1 parent 2a96d52 commit 843fe61

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/query-self.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,11 @@ export class QuerySelf implements Startable {
127127

128128
Promise.resolve()
129129
.then(async () => {
130+
if (!this.started) {
131+
this.log('not running self-query - node stopped before query started')
132+
return
133+
}
134+
130135
this.controller = new AbortController()
131136
const signal = anySignal([this.controller.signal, AbortSignal.timeout(this.queryTimeout)])
132137

@@ -165,9 +170,12 @@ export class QuerySelf implements Startable {
165170
}).finally(() => {
166171
this.running = false
167172

168-
this.log('running self-query again in %dms', this.interval)
169173
clearTimeout(this.timeoutId)
170-
this.timeoutId = setTimeout(this.querySelf.bind(this), this.interval)
174+
175+
if (this.started) {
176+
this.log('running self-query again in %dms', this.interval)
177+
this.timeoutId = setTimeout(this.querySelf.bind(this), this.interval)
178+
}
171179
})
172180
}
173181
}

0 commit comments

Comments
 (0)