Skip to content

Commit 6960b3c

Browse files
authored
Merge pull request #991: [proxima-beam-core] configurable finish bundle timeout for ProximaIO
2 parents 4f80d2b + d7750a6 commit 6960b3c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

beam/core/src/main/java/cz/o2/proxima/beam/io/ProximaIO.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,8 @@ public void startBundle() {
122122
public void finishBundle() {
123123
long startTime = System.currentTimeMillis();
124124
while (missingResponses.get() > 0) {
125-
if (System.currentTimeMillis() - startTime > bundleFinalizeTimeoutMs) {
125+
long elapsed = System.currentTimeMillis() - startTime;
126+
if (elapsed >= bundleFinalizeTimeoutMs) {
126127
throw new IllegalStateException("Failed to flush bundle within timeout of 5s");
127128
}
128129
// clone to avoid ConcurrentModificationException
@@ -136,7 +137,7 @@ public void finishBundle() {
136137
.map(
137138
f ->
138139
ExceptionUtils.uncheckedFactory(
139-
() -> f.get(bundleFinalizeTimeoutMs, TimeUnit.MILLISECONDS)))
140+
() -> f.get(bundleFinalizeTimeoutMs - elapsed, TimeUnit.MILLISECONDS)))
140141
.filter(p -> !p.getFirst())
141142
// this will be retried
142143
.filter(p -> !(p.getSecond() instanceof TransactionRejectedException))

0 commit comments

Comments
 (0)