Fix issue when VC could not be interrupted while its in pre-genesis period. (#5424)
This commit is contained in:
parent
325d5a6afa
commit
12ef43bcc0
|
@ -411,13 +411,15 @@ proc runPreGenesisWaitingLoop(vc: ValidatorClientRef) {.async.} =
|
|||
try:
|
||||
await sleepAsync(vc.beaconClock.durationToNextSlot())
|
||||
false
|
||||
except CancelledError:
|
||||
except CancelledError as exc:
|
||||
debug "Pre-genesis waiting loop was interrupted"
|
||||
true
|
||||
raise exc
|
||||
except CatchableError as exc:
|
||||
error "Pre-genesis waiting loop failed with unexpected error",
|
||||
err_name = $exc.name, err_msg = $exc.msg
|
||||
true
|
||||
|
||||
if not(breakLoop):
|
||||
vc.preGenesisEvent.fire()
|
||||
|
||||
proc runGenesisWaitingLoop(vc: ValidatorClientRef) {.async.} =
|
||||
|
@ -436,13 +438,15 @@ proc runGenesisWaitingLoop(vc: ValidatorClientRef) {.async.} =
|
|||
try:
|
||||
await sleepAsync(vc.beaconClock.durationToNextSlot())
|
||||
false
|
||||
except CancelledError:
|
||||
except CancelledError as exc:
|
||||
debug "Genesis waiting loop was interrupted"
|
||||
true
|
||||
raise exc
|
||||
except CatchableError as exc:
|
||||
error "Genesis waiting loop failed with unexpected error",
|
||||
err_name = $exc.name, err_msg = $exc.msg
|
||||
true
|
||||
|
||||
if not(breakLoop):
|
||||
vc.genesisEvent.fire()
|
||||
|
||||
proc asyncRun*(vc: ValidatorClientRef) {.async.} =
|
||||
|
@ -488,9 +492,10 @@ proc asyncRun*(vc: ValidatorClientRef) {.async.} =
|
|||
|
||||
debug "Stopping main processing loop"
|
||||
var pending: seq[Future[void]]
|
||||
if not(vc.runSlotLoopFut.finished()):
|
||||
if not(isNil(vc.runSlotLoopFut)) and not(vc.runSlotLoopFut.finished()):
|
||||
pending.add(vc.runSlotLoopFut.cancelAndWait())
|
||||
if not(vc.runKeystoreCachePruningLoopFut.finished()):
|
||||
if not(isNil(vc.runKeystoreCachePruningLoopFut)) and
|
||||
not(vc.runKeystoreCachePruningLoopFut.finished()):
|
||||
pending.add(vc.runKeystoreCachePruningLoopFut.cancelAndWait())
|
||||
if not(doppelEventFut.finished()):
|
||||
pending.add(doppelEventFut.cancelAndWait())
|
||||
|
|
Loading…
Reference in New Issue