-
-
Notifications
You must be signed in to change notification settings - Fork 631
Refactor GetSCTs to use a single loop with a ticker #8470
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
Conversation
This is a small refactor to remove a pair of closures so we can directly launch the submission goroutines with `go ctp.getOne(...)`. This is itself pulled out of a slightly larger refactor which pulls the stagger sleep back out of this function, but it's much cleaner to do this refactor as a preliminary change. There is a small functional change here: The same subCtx is passed to the submission RPC. I think that shouldn't cause any problems.
Instead of spawning all goroutines immediately with their own sleeps, this uses a ticker on the stagger interval to start additional submissions. This shouldn't change much, but unblocks future improvements like kicking off additional submissions immediately on failure to submit to a log, or adding more logic to what order we submit in based on the current results. As a small perf win, this should slightly decrease the number of goroutines as we don't typically have to submit to too many logs.
aarongable
left a comment
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.
Heck yes, I'm really happy you found a way to make this ticker-based instead of kicking off all the goroutines at once. This is going to make future changes so much easier.
keep it closer to initialization
Avoid mutating it
len(logs) no longer changes
aarongable
left a comment
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 mod doccomment.
This was needed when an earlier version of this code was mutating logs. Since it isn't needed anymore, we can just inline it.
This makes a bit more sense where the check is
Instead of spawning all goroutines immediately with their own sleeps, this uses a ticker on the stagger interval to start additional submissions.
This shouldn't change much, but unblocks future improvements like kicking off additional submissions immediately on failure to submit to a log, or adding more logic to what order we submit in based on the current results.
As a small perf win, this should slightly decrease the number of goroutines as we don't typically have to submit to too many logs.