Repository navigation
Fix money-batch settlement when requests exceed batch size - #807
Open
yeomin4242 wants to merge 1 commit into
Open
yeomin4242 wants to merge 1 commit into
yeomin4242 wants to merge 1 commit into
Conversation
yeomin4242
marked this pull request as ready for review
October 11, 2026 16:39
yeomin4242
requested review from
a team,
antmendoza and
tsurdilo
as code owners
October 11, 2026 16:39
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.
What was changed
Queue withdrawal requests and select exactly
batchSizerequests for each money-batch execution, preservingcount == batchSize.After a successful deposit, complete the workflow if no requests remain. Otherwise, continue as new with pending requests and reference IDs to preserve deduplication across executions. Pending requests wait for a full batch before their withdrawals are executed.
Propagate withdrawal failures instead of waiting indefinitely. Update the sample caller and README for the carried batch state.
This change targets new executions and does not preserve replay compatibility with the original implementation.
Why?
When withdrawal signals exceed the batch size, the completed withdrawal count can pass
batchSize, leaving the workflow waiting indefinitely. Selecting a fixed batch prevents this while preserving excess requests for the next execution.Checklist
Closes [Bug] moneybatcher sample race condition? #749
How was this tested:
Four tests pass, covering normal settlement, excess requests and deduplication across executions, requests received during a deposit, and withdrawal failure propagation. Tested with Java 21 using
./gradlew :core:cleanTest :core:test --tests 'io.temporal.samples.moneybatch.*' :core:spotlessJavaCheck. Spotless andgit diff --checkalso pass.Any docs updates needed?
Updated the money-batch README to explain batching, Continue-As-New, and compatibility.