jerqi commented on code in PR #1616:
URL: 
https://github.com/apache/incubator-uniffle/pull/1616#discussion_r1548849958


##########
internal-client/src/main/java/org/apache/uniffle/client/impl/grpc/ShuffleServerGrpcClient.java:
##########
@@ -995,6 +1027,47 @@ public String getClientInfo() {
     return "ShuffleServerGrpcClient for host[" + host + "], port[" + port + 
"]";
   }
 
+  protected void waitOrThrow(
+      RetryableRequest request, int retry, String requestInfo, StatusCode 
statusCode, long start) {
+    if (retry >= request.getRetryMax()) {
+      String msg =
+          String.format(
+              "ShuffleServer %s:%s is full when %s due to %s, after %d 
retries, cost %d ms",
+              host,
+              port,
+              request.operationType(),
+              statusCode,
+              request.getRetryMax(),
+              System.currentTimeMillis() - start);
+      LOG.error(msg);
+      throw new RssFetchFailedException(msg);
+    }
+    try {
+      long backoffTime =
+          Math.min(
+              request.getRetryIntervalMax(),
+              BACK_OFF_BASE * (1L << Math.min(retry, 16)) + 
random.nextInt(BACK_OFF_BASE));
+      LOG.warn(
+          "Can't acquire buffer for {} from {}:{} when executing {}, due to 
{}. "
+              + "Will retry {} more time(s) after waiting {} milliseconds.",
+          requestInfo,
+          host,
+          port,
+          request.operationType(),
+          statusCode,
+          request.getRetryMax() - retry,
+          backoffTime);
+      Thread.sleep(backoffTime);

Review Comment:
   use wait instead of `sleep`. Because sleep will occupy cpu.



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to