Merge branch 'feature/joint_log' into 'pre'
Feature/joint log See merge request infra/oss!56
This commit is contained in:
commit
164a46e04a
@ -357,10 +357,11 @@ public class FileServiceImpl implements FileService {
|
|||||||
|
|
||||||
private void asyncSaveFile(List<FindFileKeyResponse> resList) {
|
private void asyncSaveFile(List<FindFileKeyResponse> resList) {
|
||||||
List<CompletableFuture<Void>> completableFutures = new ArrayList<>(resList.size() / 10 + 1);
|
List<CompletableFuture<Void>> completableFutures = new ArrayList<>(resList.size() / 10 + 1);
|
||||||
Lists.partition(resList, 10)
|
Lists.partition(resList, 10).forEach(findFileKeyResponses ->
|
||||||
.forEach(findFileKeyResponses -> completableFutures.add(CompletableFuture.runAsync(
|
completableFutures.add(CompletableFuture.runAsync(() ->
|
||||||
() -> findFileKeyResponses.forEach(response -> saveFile(response))
|
findFileKeyResponses.forEach(response -> saveFile(response))
|
||||||
)));
|
)));
|
||||||
|
CompletableFuture.allOf(completableFutures.toArray(new CompletableFuture[0])).join();
|
||||||
}
|
}
|
||||||
|
|
||||||
private File saveFile(FindFileKeyResponse response) {
|
private File saveFile(FindFileKeyResponse response) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user