parveensania commented on code in PR #41825:
URL: https://github.com/apache/beam/pull/41825#discussion_r4761869428


##########
runners/google-cloud-dataflow-java/worker/src/main/java/org/apache/beam/runners/dataflow/worker/windmill/client/grpc/GrpcCommitWorkStream.java:
##########
@@ -246,18 +245,19 @@ public void onDone(Status status) {
         // Remove the requests that have exceeded the retry time so they are 
not retried.
         long nowNanos = System.nanoTime();
         long maxRetryDurationNanos = maxRetryDuration.toNanos();
-        Iterator<Map.Entry<Long, StreamAndRequest>> iterator = 
pending.entrySet().iterator();
         int keptRequests = 0, removedRequests = 0;
-        while (iterator.hasNext()) {
-          StreamAndRequest streamAndRequest = 
checkNotNull(iterator.next().getValue());
+        for (Map.Entry<Long, StreamAndRequest> entry : pending.entrySet()) {
+          StreamAndRequest streamAndRequest = checkNotNull(entry.getValue());
           PendingRequest pendingRequest = streamAndRequest.request;
           if (!belongsToThisHandler(streamAndRequest)
               || nowNanos - pendingRequest.getStartTimeNanos() < 
maxRetryDurationNanos) {
             ++keptRequests;
             continue;
           }
+          if (!pending.remove(entry.getKey(), streamAndRequest)) {
+            continue;

Review Comment:
   Added the comment



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

Reply via email to