Skip to content

Commit 1c2a4c1

Browse files
committed
Handle intermittent directory cleanup issue in parallel
1 parent b830d40 commit 1c2a4c1

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

lib/octocatalog-diff/util/parallel.rb

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,17 @@ def self.run_tasks_parallel(result, task_array, logger)
148148
# If the process doesn't exist, that's fine.
149149
end
150150
end
151-
FileUtils.remove_entry_secure ipc_tempdir if ipc_tempdir
151+
152+
retries = 0
153+
while File.directory?(ipc_tempdir) && retries < 10
154+
retries += 1
155+
begin
156+
FileUtils.remove_entry_secure ipc_tempdir
157+
rescue Errno::ENOTEMPTY, Errno::ENOENT # rubocop:disable Lint/HandleExceptions
158+
# Errno::ENOTEMPTY will trigger a retry because the directory exists
159+
# Errno::ENOENT will break the loop because the directory won't exist next time it's checked
160+
end
161+
end
152162
end
153163

154164
# Perform the tasks in serial.

0 commit comments

Comments
 (0)