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:
|
try:
|
||||||
await sleepAsync(vc.beaconClock.durationToNextSlot())
|
await sleepAsync(vc.beaconClock.durationToNextSlot())
|
||||||
false
|
false
|
||||||
except CancelledError:
|
except CancelledError as exc:
|
||||||
debug "Pre-genesis waiting loop was interrupted"
|
debug "Pre-genesis waiting loop was interrupted"
|
||||||
true
|
raise exc
|
||||||
except CatchableError as exc:
|
except CatchableError as exc:
|
||||||
error "Pre-genesis waiting loop failed with unexpected error",
|
error "Pre-genesis waiting loop failed with unexpected error",
|
||||||
err_name = $exc.name, err_msg = $exc.msg
|
err_name = $exc.name, err_msg = $exc.msg
|
||||||
true
|
true
|
||||||
|
|
||||||
|
if not(breakLoop):
|
||||||
vc.preGenesisEvent.fire()
|
vc.preGenesisEvent.fire()
|
||||||
|
|
||||||
proc runGenesisWaitingLoop(vc: ValidatorClientRef) {.async.} =
|
proc runGenesisWaitingLoop(vc: ValidatorClientRef) {.async.} =
|
||||||
|
@ -436,13 +438,15 @@ proc runGenesisWaitingLoop(vc: ValidatorClientRef) {.async.} =
|
||||||
try:
|
try:
|
||||||
await sleepAsync(vc.beaconClock.durationToNextSlot())
|
await sleepAsync(vc.beaconClock.durationToNextSlot())
|
||||||
false
|
false
|
||||||
except CancelledError:
|
except CancelledError as exc:
|
||||||
debug "Genesis waiting loop was interrupted"
|
debug "Genesis waiting loop was interrupted"
|
||||||
true
|
raise exc
|
||||||
except CatchableError as exc:
|
except CatchableError as exc:
|
||||||
error "Genesis waiting loop failed with unexpected error",
|
error "Genesis waiting loop failed with unexpected error",
|
||||||
err_name = $exc.name, err_msg = $exc.msg
|
err_name = $exc.name, err_msg = $exc.msg
|
||||||
true
|
true
|
||||||
|
|
||||||
|
if not(breakLoop):
|
||||||
vc.genesisEvent.fire()
|
vc.genesisEvent.fire()
|
||||||
|
|
||||||
proc asyncRun*(vc: ValidatorClientRef) {.async.} =
|
proc asyncRun*(vc: ValidatorClientRef) {.async.} =
|
||||||
|
@ -488,9 +492,10 @@ proc asyncRun*(vc: ValidatorClientRef) {.async.} =
|
||||||
|
|
||||||
debug "Stopping main processing loop"
|
debug "Stopping main processing loop"
|
||||||
var pending: seq[Future[void]]
|
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())
|
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())
|
pending.add(vc.runKeystoreCachePruningLoopFut.cancelAndWait())
|
||||||
if not(doppelEventFut.finished()):
|
if not(doppelEventFut.finished()):
|
||||||
pending.add(doppelEventFut.cancelAndWait())
|
pending.add(doppelEventFut.cancelAndWait())
|
||||||
|
|
Loading…
Reference in New Issue