gemini-code-assist[bot] commented on code in PR #37831:
URL: https://github.com/apache/beam/pull/37831#discussion_r2921399586
##########
runners/core-java/src/main/java/org/apache/beam/runners/core/SplittableParDoViaKeyedWorkItems.java:
##########
@@ -598,15 +610,16 @@ public String getErrorContext() {
Instant wakeupTime =
timerInternals.currentProcessingTime().plus(result.getContinuation().resumeDelay());
holdState.add(futureOutputWatermark);
- // Set a timer to continue processing this element.
- // todo radoslws@ decide if draining should be set on timer
- timerInternals.setTimer(
- TimerInternals.TimerData.of(
- stateNamespace,
- wakeupTime,
- wakeupTime,
- TimeDomain.PROCESSING_TIME,
- timer == null ? CausedByDrain.NORMAL : timer.causedByDrain()));
+ // Set a timer to continue processing this element, but only when no
drain
+ if (timer == null || timer.causedByDrain() == CausedByDrain.NORMAL) {
+ timerInternals.setTimer(
+ TimerInternals.TimerData.of(
+ stateNamespace,
+ wakeupTime,
+ wakeupTime,
+ TimeDomain.PROCESSING_TIME,
+ timer == null ? CausedByDrain.NORMAL : timer.causedByDrain()));
Review Comment:

The expression `timer == null ? CausedByDrain.NORMAL :
timer.causedByDrain()` will always evaluate to `CausedByDrain.NORMAL` within
this `if` block. This is because if `timer` is not null, the condition
`timer.causedByDrain() == CausedByDrain.NORMAL` must be true to enter the
block. You can simplify this by directly using `CausedByDrain.NORMAL` for
clarity.
```suggestion
CausedByDrain.NORMAL));
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]