You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by "ctubbsii (via GitHub)" <gi...@apache.org> on 2023/03/17 19:26:49 UTC

[GitHub] [accumulo] ctubbsii commented on a diff in pull request #3244: Alternate time wait calculation using nanos

ctubbsii commented on code in PR #3244:
URL: https://github.com/apache/accumulo/pull/3244#discussion_r1140627528


##########
server/manager/src/main/java/org/apache/accumulo/manager/Manager.java:
##########
@@ -1024,12 +1024,11 @@ private SortedMap<TServerInstance,TabletServerStatus> gatherTableInformation(
         }
       }));
     }
-    final long timeToWaitForCompletion = Math.max(10000, rpcTimeout / 3);
+    final long timeToWaitNanos = MILLISECONDS.toNanos(Math.max(10_000, rpcTimeout / 3));

Review Comment:
   To avoid the loss of precision when dividing by 3, could convert to nanos before dividing. Could also convert from seconds instead of millis for the numeric literal:
   
   ```suggestion
       // wait at least 10 seconds
       final long timeToWaitNanos = Math.max(SECONDS.toNanos(10), MILLISECONDS.toNanos(rpcTimeout) / 3);
   ```



-- 
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: notifications-unsubscribe@accumulo.apache.org

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