Skip to content

Commit af9957c

Browse files
committed
Revert "disable advisory locks"
This reverts commit 892fd9f.
1 parent 5c42756 commit af9957c

File tree

3 files changed

+6
-0
lines changed

3 files changed

+6
-0
lines changed

apps/webapp/app/services/runs/startRun.server.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ export class StartRunService {
6464
await $transaction(
6565
this.#prismaClient,
6666
async (tx) => {
67+
await tx.$executeRaw`SELECT pg_advisory_xact_lock(${lockId})`;
68+
6769
const counter = await tx.jobCounter.upsert({
6870
where: { jobId: run.jobId },
6971
update: { lastNumber: { increment: 1 } },

apps/webapp/app/services/sources/handleWebhookRequest.server.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ export class HandleWebhookRequestService {
3737
const lockId = webhookIdToLockId(webhookEnvironment.webhookId);
3838

3939
await this.#prismaClient.$transaction(async (tx) => {
40+
await tx.$executeRaw`SELECT pg_advisory_xact_lock(${lockId})`;
41+
4042
const counter = await tx.webhookDeliveryCounter.upsert({
4143
where: { webhookId: webhookEnvironment.id },
4244
update: { lastNumber: { increment: 1 } },

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ export class TriggerTaskService extends BaseService {
8888
const lockId = taskIdentifierToLockId(taskId);
8989

9090
const run = await $transaction(this._prisma, async (tx) => {
91+
await tx.$executeRaw`SELECT pg_advisory_xact_lock(${lockId})`;
92+
9193
const lockedToBackgroundWorker = body.options?.lockToVersion
9294
? await tx.backgroundWorker.findUnique({
9395
where: {

0 commit comments

Comments
 (0)