fix: Log failures when scheduling collection duplication task (#13251)

This commit is contained in:
Tom Moor
2026-08-02 11:21:16 +00:00
committed by GitHub
parent efc68de4a0
commit bc3b3b3f97
+15 -1
View File
@@ -1,3 +1,5 @@
import { toError } from "@shared/utils/error";
import Logger from "@server/logging/Logger";
import { Collection } from "@server/models";
import DuplicateCollectionDocumentsTask from "@server/queues/tasks/DuplicateCollectionDocumentsTask";
import type { APIContext } from "@server/types";
@@ -55,7 +57,19 @@ export default async function collectionDuplicator(
});
if (transaction) {
transaction.afterCommit(() => void scheduleTask());
transaction.afterCommit(async () => {
try {
await scheduleTask();
} catch (err) {
Logger.error(
"Failed to schedule duplicate collection documents task",
toError(err),
{
collectionId: duplicated.id,
}
);
}
});
} else {
await scheduleTask();
}