m-trieu commented on code in PR #31784:
URL: https://github.com/apache/beam/pull/31784#discussion_r1691685304


##########
runners/google-cloud-dataflow-java/worker/src/main/java/org/apache/beam/runners/dataflow/worker/windmill/work/refresh/ActiveWorkRefresher.java:
##########
@@ -103,5 +115,32 @@ private void invalidateStuckCommits() {
     }
   }
 
-  protected abstract void refreshActiveWork();
+  private void refreshActiveWork() {
+    Instant refreshDeadline = 
clock.get().minus(Duration.millis(activeWorkRefreshPeriodMillis));
+
+    Map<HeartbeatSender, Heartbeats.Builder> heartbeatsBySender = new 
HashMap<>();
+
+    // Aggregate the heartbeats across computations by HeartbeatSender for 
correct fan out.
+    for (ComputationState computationState : computations.get()) {
+      for (RefreshableWork work : 
computationState.getRefreshableWork(refreshDeadline)) {
+        heartbeatsBySender
+            .computeIfAbsent(work.heartbeatSender(), ignored -> 
Heartbeats.builder())
+            .addWork(work)

Review Comment:
   done



-- 
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: github-unsubscr...@beam.apache.org

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

Reply via email to