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. Stacked on #524 (base: espresso/simplify-worker-pool): review/merge that one first.
What
#524 removed the hand-rolled load balancer. This goes the rest of the way: it replaces the whole submit/verify worker-pool machinery with one goroutine per transaction, bounded by an errgroup.
SubmitTransactioncallseg.TryGo(...), which runssubmitAndConfirmfor that transaction in its owngoroutine.submitAndConfirmruns the full lifecycle inline:submit-with-retry, thenpoll-for-receipt-with-retry; a verification timeout loops back to re-submit.evaluateSubmission/evaluateVerificationbecome pure functions, so they're directly unit-testable.This matches the spec's wording ("for each block, spawn a goroutine that submits the batch and waits for finalization").
Removed
4 job/response structs, 6 channels, both scheduler/handler goroutines, both worker functions and
SpawnWorkers, the atomic in-flight counter, and the queue-capacity config. Net ~−228 lines on top of #524.Behavior
Unchanged: fast-reject
backpressure(ErrTooManyInFlightRequestsviaTryGo, never blocks), the retry/re-submit logic,SubmitTransaction's signature. The queueing loop still treats a reject as "retry next tick," so no blocks are dropped.Two deliberate changes for a reviewer's eye:
retryDelay(100ms) instead of immediately. The old immediate retry was throttled by the fixed worker count, which no longer exists.Also: the higher concurrency ceiling (up to 128 simultaneous SDK calls vs the old ~8) is only approached under sustained backlog; in steady state only a handful of goroutines are alive.
Testing
Commands:
All pass, including under -race.