je-ik commented on a change in pull request #12155:
URL: https://github.com/apache/beam/pull/12155#discussion_r448579090



##########
File path: 
runners/direct-java/src/main/java/org/apache/beam/runners/direct/StatefulParDoEvaluatorFactory.java
##########
@@ -270,11 +177,13 @@ public void processElement(WindowedValue<KeyedWorkItem<K, 
KV<K, InputT>>> gbkRes
         delegateEvaluator.processElement(windowedValue);
       }
 
-      Instant currentInputWatermark = 
timerInternals.currentInputWatermarkTime();
+      final Instant inputWatermarkTime = 
timerInternals.currentInputWatermarkTime();
       PriorityQueue<TimerData> toBeFiredTimers =
           new PriorityQueue<>(Comparator.comparing(TimerData::getTimestamp));
       gbkResult.getValue().timersIterable().forEach(toBeFiredTimers::add);
-      while (!toBeFiredTimers.isEmpty()) {
+
+      while (!timerInternals.containsUpdateForTimeBefore(inputWatermarkTime)
+          && !toBeFiredTimers.isEmpty()) {

Review comment:
       It can happen that elements processed inside this bundle set timer, so 
it is technically better to check this before firing any timer. In practice it 
probably doesn't matter, because DirectRunner currently apparently doesn't fix 
bundles with timers and bundles with elements.




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to