Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Optimize block processing - Part 3 #802
Optimize block processing - Part 3 #802
Changes from 11 commits
9c7c527
a81dd0f
10673fc
2cfe332
64593d9
e4bcbd8
6721103
cf8d7c1
acaa23c
d2cda13
8f20220
a4c9e69
4763f13
fd21a45
2f0da1f
a57af4b
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
This seems wrong to me. Shouldn't we want to skip handlers which have the same priority, but a different id?
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 idea is the find the last posted function. If it same as you are attempting to post, don't bother.
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.
Could it be as simple as this?
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.
No. You have to find the last posted handler with the same priority and see if that one has the same id.
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.
Why does it has to be the last posted one? Why does it matter if something else was posted later with the same priority?
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.
This goes with the more conservative approach of only de-dup on matching id for a given priority when it was the last id posted.
Say you have items in the queue, u=unique, pb=process_incoming_block
q9(u) q8(pb) q7(u)
Say you want to post a
q6(pb)
, it is possible this is not safe to de-dup because ifq7(u)
does something that needsq6(pb)
to run then you end up withq6(pb)
not running. So this goes with the more conservative route of only de-dup ifq7(u)
is apb
. Granted we could argue thatq7(u)
should post apb
if needs that to happen.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 code I sent dedups only if it is the same id (pb) at the same priority, so in your example posting
q6(pb)
would not dedup as there is no otherq6(pb)
in the queue. Or am I missing something?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 9,8,7 are just order numbers. They are all the same priority.
q9(u) q8(pb) q7(u)
So your code would find
q8(pb)
and return (de-dup). Want to only compare toq7(u)
and then non-dedup.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.
Is there a reason for this requirement, i.e would the code not work if we didn't check that it was the last posted? It seems to me that either we want to dedup, and then we should just do it, or not.
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.
Been thinking about this. Maybe I am being too conservative. If the last item running needs to have a follow non-unique item it should post it.