Skip to content

Commit 42ab21f

Browse files
committed
fix(webapp): bound the background worker schedule cleanup list filters
Two new sites from main. Both are deleteMany filters, where duplicates in the list do not change which rows are removed. Also consolidates a stray bottom-of- file import onto the existing db.server one.
1 parent b91f78b commit 42ab21f

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

apps/webapp/app/v3/services/createBackgroundWorker.server.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { BackgroundWorkerId, stringifyDuration } from "@trigger.dev/core/v3/isom
1111
import type { BackgroundWorker, TaskQueue, TaskQueueType } from "@trigger.dev/database";
1212
import cronstrue from "cronstrue";
1313
import type { PrismaClientOrTransaction } from "~/db.server";
14-
import { $transaction, Prisma } from "~/db.server";
14+
import { $transaction, Prisma, boundedIn } from "~/db.server";
1515
import { sanitizeQueueName } from "~/models/taskQueue.server";
1616
import type { AuthenticatedEnvironment } from "~/services/apiAuth.server";
1717
import { logger } from "~/services/logger.server";
@@ -794,7 +794,7 @@ export async function syncDeclarativeSchedules(
794794
await prisma.taskSchedule.deleteMany({
795795
where: {
796796
id: {
797-
in: scheduleIdsToDelete,
797+
in: boundedIn(scheduleIdsToDelete),
798798
},
799799
},
800800
});
@@ -804,7 +804,7 @@ export async function syncDeclarativeSchedules(
804804
await prisma.taskScheduleInstance.deleteMany({
805805
where: {
806806
taskScheduleId: {
807-
in: scheduleIdsToDetachFromEnvironment,
807+
in: boundedIn(scheduleIdsToDetachFromEnvironment),
808808
},
809809
environmentId: environment.id,
810810
},
@@ -864,7 +864,6 @@ export async function createBackgroundFiles(
864864

865865
import { createHash } from "crypto";
866866

867-
import { boundedIn } from "@trigger.dev/database";
868867
function hashContent(content: string): string {
869868
return createHash("sha256").update(content).digest("hex").slice(0, 16);
870869
}

0 commit comments

Comments
 (0)