Skip to content

Commit

Permalink
PATCH: perf: use async.eachLimit avoid problems when deleting documen…
Browse files Browse the repository at this point in the history
…ts (#499)
  • Loading branch information
NicolasRichel authored Jan 7, 2025
1 parent 826919d commit fa5b2b4
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/services/FileService.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import eachLimit from "async/eachLimit";
import { FILE_TYPE } from "../config/files.js";
import { download } from "../utils/download.js";
import { segregate } from "../utils/file-structure.js";
Expand Down Expand Up @@ -143,13 +144,13 @@ class FileService {

async deleteDocuments(project, documents) {
try {
return await Promise.all(
documents.map(document =>
apiClient.collaborationApi.deleteAllDocumentHistory(
project.cloud.id,
document.id,
project.id
)
return await eachLimit(
documents,
5,
document => apiClient.collaborationApi.deleteAllDocumentHistory(
project.cloud.id,
document.id,
project.id
)
);
} catch (error) {
Expand Down

0 comments on commit fa5b2b4

Please sign in to comment.