Skip to content

Commit 317f7a4

Browse files
committed
batch the deletes
1 parent 21fef7c commit 317f7a4

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/main/java/com/lowtuna/jsonblob/core/DataDirectoryCleanupJob.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,9 @@ public DateTime apply(@Nullable String input) {
7070
return;
7171
}
7272

73-
log.debug("Submitting BulkBlobDeleteJob for {} blobs in {}", toRemove.size(), dir);
74-
executorService.submit(new BulkBlobDeleteJob(toRemove.keySet(), fileSystemJsonBlobManager, deleteEnabled));
73+
log.debug("Submitting BulkBlobDeleteJobs for {} blobs in {}", toRemove.size(), dir);
74+
List<List<String>> subSets = Lists.partition(Lists.newArrayList(toRemove.keySet()), 100);
75+
subSets.parallelStream().forEach(list -> executorService.submit(new BulkBlobDeleteJob(Sets.newHashSet(list), fileSystemJsonBlobManager, deleteEnabled)));
7576
} catch (IOException e) {
7677
log.warn("Couldn't load metadata file from {}", dir.getAbsolutePath(), e);
7778
}

0 commit comments

Comments
 (0)