File tree 1 file changed +9
-2
lines changed
src/main/java/com/uber/cadence/internal/replay
1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -598,7 +598,7 @@ private class DecisionTaskWithHistoryIteratorImpl implements DecisionTaskWithHis
598
598
private final Duration paginationStart = Duration .ofMillis (System .currentTimeMillis ());
599
599
private Duration decisionTaskStartToCloseTimeout ;
600
600
601
- private final Duration retryServiceOperationExpirationInterval () {
601
+ private final Duration decisionTaskRemainingTime () {
602
602
Duration passed = Duration .ofMillis (System .currentTimeMillis ()).minus (paginationStart );
603
603
return decisionTaskStartToCloseTimeout .minus (passed );
604
604
}
@@ -642,11 +642,18 @@ public HistoryEvent next() {
642
642
return current .next ();
643
643
}
644
644
645
+ Duration decisionTaskRemainingTime = decisionTaskRemainingTime ();
646
+ if (decisionTaskRemainingTime .isNegative () || decisionTaskRemainingTime .isZero ()) {
647
+ throw new Error (
648
+ "Decision task timed out while querying history. If this happens consistently please consider " +
649
+ "increase decision task timeout or reduce history size." );
650
+ }
651
+
645
652
metricsScope .counter (MetricsType .WORKFLOW_GET_HISTORY_COUNTER ).inc (1 );
646
653
Stopwatch sw = metricsScope .timer (MetricsType .WORKFLOW_GET_HISTORY_LATENCY ).start ();
647
654
RetryOptions retryOptions =
648
655
new RetryOptions .Builder ()
649
- .setExpiration (retryServiceOperationExpirationInterval () )
656
+ .setExpiration (decisionTaskRemainingTime )
650
657
.setInitialInterval (retryServiceOperationInitialInterval )
651
658
.setMaximumInterval (retryServiceOperationMaxInterval )
652
659
.build ();
You can’t perform that action at this time.
0 commit comments