-
Notifications
You must be signed in to change notification settings - Fork 5
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
Avoid voting until caught up with network #262
Conversation
if (!enable_voting) { // Avoid extra processing while syncing. Once caught up, consider voting | ||
if (bsp->timestamp() < fc::time_point::now() - fc::seconds(30)) | ||
return; | ||
enable_voting = true; | ||
} |
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.
move before line 97 to avoid extra memory allocation+free when syncing
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.
The enable_voting
is protected by the mutex.
- Could make it atomic
- Could move the
.reserve()
call after and inside the mutex lock - Could leave it as is
Not clear to me which is better. Maybe atomic.
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.
Yes, I think atomic
may be best. Even without atomic
, it seems that the worse that could happen is for a couple extra votes to go though.
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.
or move the reserve within the mutex protection, even simpler imo.
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.
Maybe even better would be to do this check on the main thread before we call consider_voting(bsp, use_thread_pool_t::yes);
, so we don't post unneeded tasks on the thread pool.
Do not post to thread pool while syncing/replaying
Note:start |
Resolves #259