-
Notifications
You must be signed in to change notification settings - Fork 18
Fix parallelization config for writes #188
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -19,6 +19,7 @@ public class ClientWriteOptions implements AdditionalHeadersSupplier { | |||||||||||||||||||||||
private String authorizationModelId; | ||||||||||||||||||||||||
private Boolean disableTransactions = false; | ||||||||||||||||||||||||
private int transactionChunkSize; | ||||||||||||||||||||||||
private Integer maxParallelRequests; | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
public ClientWriteOptions additionalHeaders(Map<String, String> additionalHeaders) { | ||||||||||||||||||||||||
this.additionalHeaders = additionalHeaders; | ||||||||||||||||||||||||
|
@@ -56,4 +57,13 @@ public ClientWriteOptions transactionChunkSize(int transactionChunkSize) { | |||||||||||||||||||||||
public int getTransactionChunkSize() { | ||||||||||||||||||||||||
return transactionChunkSize > 0 ? transactionChunkSize : 1; | ||||||||||||||||||||||||
} | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
public ClientWriteOptions maxParallelRequests(Integer maxParallelRequests) { | ||||||||||||||||||||||||
this.maxParallelRequests = maxParallelRequests; | ||||||||||||||||||||||||
return this; | ||||||||||||||||||||||||
} | ||||||||||||||||||||||||
Comment on lines
+61
to
+64
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Add input validation for the setter method. The setter accepts any Integer value including negative numbers, which could lead to invalid configurations. Consider adding validation to ensure only positive values are accepted. public ClientWriteOptions maxParallelRequests(Integer maxParallelRequests) {
+ if (maxParallelRequests != null && maxParallelRequests < 1) {
+ throw new IllegalArgumentException("maxParallelRequests must be greater than 0");
+ }
this.maxParallelRequests = maxParallelRequests;
return this;
} 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents
|
||||||||||||||||||||||||
|
||||||||||||||||||||||||
public Integer getMaxParallelRequests() { | ||||||||||||||||||||||||
return maxParallelRequests; | ||||||||||||||||||||||||
} | ||||||||||||||||||||||||
} |
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.
🛠️ Refactor suggestion
Critical: Only the last response is returned in parallel execution mode.
When executing multiple transactions in parallel, the current implementation only returns the last successful response (line 477), discarding results from all other transactions. This means:
Consider aggregating all responses or returning a composite response that includes results from all transactions.
🤖 Prompt for AI Agents