Draczech commented on a change in pull request #12560:
URL: https://github.com/apache/flink/pull/12560#discussion_r438093694



##########
File path: 
flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/history/HistoryServerArchiveFetcher.java
##########
@@ -302,18 +289,37 @@ public void run() {
 
                        cachedArchives.removeAll(jobsToRemove);
                        jobsToRemove.forEach(removedJobID -> {
-                               try {
-                                       Files.deleteIfExists(new 
File(webOverviewDir, removedJobID + JSON_FILE_ENDING).toPath());
-                                       FileUtils.deleteDirectory(new 
File(webJobDir, removedJobID));
-                               } catch (IOException e) {
-                                       LOG.error("Failure while removing job 
overview for job {}.", removedJobID, e);
-                               }
+                               deleteJobFiles(removedJobID);
                                deleteLog.add(new ArchiveEvent(removedJobID, 
ArchiveEventType.DELETED));
                        });
 
                        return deleteLog;
                }
 
+               private void deleteJobFiles(String jobID) {
+                       // Make sure we do not include this job in the overview
+                       try {
+                               Files.deleteIfExists(new File(webOverviewDir, 
jobID + JSON_FILE_ENDING).toPath());
+                       } catch (IOException ioe) {
+                               LOG.warn("Could not delete file from overview 
directory.", ioe);

Review comment:
       For this reason I also changed deleting method to 
`Files.deleteIfExists`. So there should be logs only for cases when deleting of 
actually existing file fails. Also `FileUtils.deleteDirectory` doesn't do 
anything in case the directory doesn't exist.
   
   So warning is used only if there is an actual problem with deleting existing 
files. Let me know if it is desired level for such cases.




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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to