songxiaosheng commented on code in PR #14262:
URL: https://github.com/apache/dubbo/pull/14262#discussion_r1625765999


##########
dubbo-common/src/main/java/org/apache/dubbo/common/cache/FileCacheStore.java:
##########
@@ -150,10 +151,21 @@ private static void deleteFile(File f) {
 
         Path pathOfFile = f.toPath();
 
-        try {
-            Files.delete(pathOfFile);
-        } catch (IOException ioException) {
-            logger.debug("Failed to delete file " + f.getAbsolutePath(), 
ioException);
+        for (int i = 0; i < MAX_RETRIES; i++) {
+            try {
+                Files.delete(pathOfFile);
+                if (!Files.exists(pathOfFile)) {
+                    logger.debug("Successfully deleted file " + 
f.getAbsolutePath());
+                    return;
+                }
+            } catch (IOException ioException) {
+                logger.debug("Failed to delete file " + f.getAbsolutePath() + 
" on attempt " + (i + 1), ioException);
+            }
+            try {
+                Thread.sleep(1000); // Pause before retrying

Review Comment:
   Is there any problem with not sleeping?



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