-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
refactor: minimize locking in ChainLocks Cleanup #5990
Conversation
@@ -665,8 +666,6 @@ void CChainLocksHandler::Cleanup() | |||
++it; | |||
} | |||
} | |||
|
|||
lastCleanupTime = GetTimeMillis(); |
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.
can it change behavior in case if Cleanup()
will take significant time?
It can cause of new iteration of Cleanup
start immediately after previous iteration is done if cs_main
will be busy for awhile and cleaning process will take a long time due to that.
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.
It in theory could; but in practice I don't see how it possibly could. I think Cleanup is only done every 30 seconds; and I don't see it being a problem if cleanup happens after extra 30 seconds.
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.
possible if you debug application and run it step-by-step, but I guess that is not really important
Doubt 9184edb would make any difference because Lines 206 to 208 in 9184edb
|
Agreed; it just feels the more correct way to update it |
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.
utACK
...but needs rebase to fix tests :) |
9184edb
to
04ba164
Compare
d44b0d5
Issue being fixed or feature implemented
Simple changes, just look at the two commits: first we minimize scope of cs_main to what actually needs it. Then we change where we update the
lastCleanupTime
to right after we check it to minimize any chance of two threads entering at the same time.What was done?
How Has This Been Tested?
Built, ran for a bit
Breaking Changes
None
Checklist:
Go over all the following points, and put an
x
in all the boxes that apply.