You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "songxiaosheng (via GitHub)" <gi...@apache.org> on 2024/06/04 10:32:11 UTC
Re: [PR] Changes for issue 14256 [dubbo]
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: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org