diff --git a/src/app/op-log/apply/archive-operation-handler.service.ts b/src/app/op-log/apply/archive-operation-handler.service.ts index 3d44039ec..444020168 100644 --- a/src/app/op-log/apply/archive-operation-handler.service.ts +++ b/src/app/op-log/apply/archive-operation-handler.service.ts @@ -263,12 +263,14 @@ export class ArchiveOperationHandler { const taskArchiveService = this._getTaskArchiveService(); // Filter to only tasks that exist in archive - const archiveUpdates: Update[] = []; - for (const update of taskUpdates) { - if (await taskArchiveService.hasTask(update.id as string)) { - archiveUpdates.push(update); - } - } + // Check all tasks in parallel for better performance + const hasTaskResults = await Promise.all( + taskUpdates.map((update) => taskArchiveService.hasTask(update.id as string)), + ); + + const archiveUpdates: Update[] = taskUpdates.filter( + (_, i) => hasTaskResults[i], + ); if (archiveUpdates.length > 0) { await taskArchiveService.updateTasks(archiveUpdates, {