add explicit timeout when sending watchdog requests (#7)

This commit is contained in:
Ivan FB 2026-01-16 15:48:35 +01:00 committed by GitHub
parent c2cc2d7ea1
commit 9fff004b19
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -103,6 +103,7 @@ proc watchdogThreadBody(ctx: ptr FFIContext) {.thread.} =
let watchdogRun = proc(ctx: ptr FFIContext) {.async.} =
const WatchdogStartDelay = 10.seconds
const WatchdogTimeinterval = 1.seconds
const WatchdogTimeout = 20.seconds
# Give time for the node to be created and up before sending watchdog requests
await sleepAsync(WatchdogStartDelay)
@ -121,7 +122,7 @@ proc watchdogThreadBody(ctx: ptr FFIContext) {.thread.} =
trace "Sending watchdog request to FFI thread"
sendRequestToFFIThread(ctx, WatchdogReq.ffiNewReq(callback, nilUserData)).isOkOr:
sendRequestToFFIThread(ctx, WatchdogReq.ffiNewReq(callback, nilUserData), WatchdogTimeout).isOkOr:
error "Failed to send watchdog request to FFI thread", error = $error
onNotResponding(ctx)