Skip to content

Commit

Permalink
Add check if shutting down before timer rearm
Browse files Browse the repository at this point in the history
The `Validator.discoveryTask` has been seen to cause `range violation`
in a test where the node is restarted. A check for if the node is
shutting down should prevent this.
  • Loading branch information
hewison-chris committed Mar 11, 2022
1 parent fa29394 commit 3545940
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion source/agora/node/FullNode.d
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ public class FullNode : API
this.startTaskTimer(TimersIdx.BlockCatchup, this.config.node.block_catchup_interval);
}

private void startTaskTimer (in TimersIdx timer_id, in Duration interval) @trusted nothrow
protected void startTaskTimer (in TimersIdx timer_id, in Duration interval) @trusted nothrow
{
log.dbg("{}: re-arm timer index {}", __FUNCTION__, timer_id);
if (!this.is_shutting_down)
Expand Down
3 changes: 2 additions & 1 deletion source/agora/node/Validator.d
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,8 @@ public class Validator : FullNode, API
protected override void discoveryTask ()
{
this.network.discover(this.required_peer_utxos);
this.timers[TimersIdx.Discovery].rearm(this.config.node.network_discovery_interval, false);
this.startTaskTimer(FullNode.TimersIdx.Discovery,
this.config.node.network_discovery_interval);
}

///
Expand Down

0 comments on commit 3545940

Please sign in to comment.