fix: only stop health monitor components if not nil (#3526)

This commit is contained in:
gabrielmer 2025-07-24 16:33:49 +02:00 committed by GitHub
parent 59949e4cfe
commit 07fa47589b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -408,8 +408,11 @@ proc startHealthMonitor*(hm: NodeHealthMonitor): Result[void, string] =
return ok()
proc stopHealthMonitor*(hm: NodeHealthMonitor) {.async.} =
await hm.onlineMonitor.stopOnlineMonitor()
await hm.keepAliveFut.cancelAndWait()
if not hm.onlineMonitor.isNil():
await hm.onlineMonitor.stopOnlineMonitor()
if not hm.keepAliveFut.isNil():
await hm.keepAliveFut.cancelAndWait()
proc new*(
T: type NodeHealthMonitor,