fix: propagate callback cancellation so timer does not get stuck during stop

This commit is contained in:
gmega 2026-02-04 16:41:22 -03:00
parent 7c3894da54
commit 444a5bff7a
No known key found for this signature in database
GPG Key ID: 6290D34EAD824B18
2 changed files with 3 additions and 2 deletions

View File

@ -100,12 +100,13 @@ proc runBlockCheck(
trace "Cycle completed"
proc start*(self: BlockMaintainer) =
proc onTimer(): Future[void] {.async: (raises: []).} =
proc onTimer(): Future[void] {.async: (raises: [CancelledError]).} =
try:
await self.runBlockCheck()
except CancelledError as err:
trace "Running block check in block maintenance timer callback cancelled: ",
err = err.msg
raise err
self.timer.start(onTimer, self.interval)

View File

@ -17,7 +17,7 @@ import pkg/chronos
import ../logutils
type
TimerCallback* = proc(): Future[void] {.async: (raises: []).}
TimerCallback* = proc(): Future[void] {.async: (raises: [CancelledError]).}
Timer* = ref object of RootObj
callback: TimerCallback
interval: Duration