Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Part of #506.
What
The submit/verify worker pool hand-rolled a load balancer: per stage, an extra
chan chan …"worker queue" onto which idle workers advertised a private channel, plus a scheduler goroutine that matched each waiting job to an advertised worker.N workers all receiving from one shared channel already do exactly that — the Go runtime hands each job to whichever worker is ready. So this removes the hand-rolled version:
submitJobQueue/verifyReceiptJobQueuedirectly and reply on the shared response queues.scheduleSubmitTransactionJobs,scheduleVerifyReceiptsJobs), the twochan chanworker queues, and the two*JobAttemptwrapper structs.Net −129 lines (43 insertions, 172 deletions), two fewer goroutines, one hop per job instead of three.
Behavior is unchanged
Same buffered queues and capacities, same in-flight counter and fast-reject (
ErrSubmitToEspressoChannelFull), same response handlers and retry/re-submit paths, sameSpawnWorkers(4, 4)surface. Only the plumbing shrank. Workers also now exit cleanly if the job channel is ever closed (aokcheck), in addition to the existingctx.Done()path.This is the safe, behavior-identical subset. The larger
errgroup.SetLimitrewrite (pureevaluate*, per-blocksubmitAndConfirm) from the issue is a follow-up, since it changes backpressure semantics.Testing
go build ./op-batcher/...go test ./op-batcher/batcher/...(incl.-race) — passes; the existing submitter progress test drives the pool end-to-end viaSpawnWorkers(4, 4).