-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue 2772 - part A: Refactor timers in Nominator
#3024
Issue 2772 - part A: Refactor timers in Nominator
#3024
Conversation
Codecov Report
@@ Coverage Diff @@
## v0.x.x #3024 +/- ##
==========================================
+ Coverage 19.83% 20.28% +0.45%
==========================================
Files 61 68 +7
Lines 2702 2923 +221
==========================================
+ Hits 536 593 +57
- Misses 2166 2330 +164
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
// ignore messages if `startNominatingTimer` was never called or | ||
// if `stopNominatingTimer` was called | ||
if (this.nomination_timer is null) | ||
return; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this removal be in another commit or the second commit because it changes the handling algorithm?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't work as expected so is reverted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strangely ValidatorCleanRestart
passes without removing this 🤔
8f8d58b
to
1cf5e28
Compare
🟢 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, Do you think this PR is also meaningful to solve the failure of ValidatorCleanRestart
? I just wanted to know that this is related to issue #2971.
I am not sure. I will create a separate PR with just the |
|
18a3f2a
to
6da9970
Compare
Nominator
Nominator
Nominator
Nominator
6da9970
to
87f499d
Compare
this.nomination_timer.stop(); | ||
this.nomination_timer = null; | ||
this.timers[TimersIdx.Nomination].stop(); | ||
this.timers[TimersIdx.Nomination] = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We actually dont need to null it here, we can reuse the same timer every slot.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did try to remove it but we compare it to null here:
agora/source/agora/consensus/protocol/Nominator.d
Lines 625 to 630 in 83349fd
private void handleSCPEnvelope (in SCPEnvelope envelope) @trusted | |
{ | |
// ignore messages if `startNominatingTimer` was never called or | |
// if `stopNominatingTimer` was called | |
if (this.nomination_timer is null) | |
return; |
I don't think we can check if the timer is stopped
.
Maybe pending
could be used but I think it may be false when actually running the task.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
then feel free to merge when CI is green
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, rebased on a green upstream 🤞
Use enums to identify timers within an array of timers. Just create them in the constructor and arm them when needed. Stop all timers on shutdown.
87f499d
to
b330e63
Compare
Will merge this as this commit is the first in #3037 which is green. |
Using a similar approach to timers in the
FullNode
andValidator
classes.This is partly in preparation for adding another timer for checking when we can externalize with majority of signed
in PR #3026
Part of #2772