File tree Expand file tree Collapse file tree 3 files changed +6
-0
lines changed Expand file tree Collapse file tree 3 files changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -64,6 +64,8 @@ export class StartRunService {
64
64
await $transaction (
65
65
this . #prismaClient,
66
66
async ( tx ) => {
67
+ await tx . $executeRaw `SELECT pg_advisory_xact_lock(${ lockId } )` ;
68
+
67
69
const counter = await tx . jobCounter . upsert ( {
68
70
where : { jobId : run . jobId } ,
69
71
update : { lastNumber : { increment : 1 } } ,
Original file line number Diff line number Diff line change @@ -37,6 +37,8 @@ export class HandleWebhookRequestService {
37
37
const lockId = webhookIdToLockId ( webhookEnvironment . webhookId ) ;
38
38
39
39
await this . #prismaClient. $transaction ( async ( tx ) => {
40
+ await tx . $executeRaw `SELECT pg_advisory_xact_lock(${ lockId } )` ;
41
+
40
42
const counter = await tx . webhookDeliveryCounter . upsert ( {
41
43
where : { webhookId : webhookEnvironment . id } ,
42
44
update : { lastNumber : { increment : 1 } } ,
Original file line number Diff line number Diff line change @@ -88,6 +88,8 @@ export class TriggerTaskService extends BaseService {
88
88
const lockId = taskIdentifierToLockId ( taskId ) ;
89
89
90
90
const run = await $transaction ( this . _prisma , async ( tx ) => {
91
+ await tx . $executeRaw `SELECT pg_advisory_xact_lock(${ lockId } )` ;
92
+
91
93
const lockedToBackgroundWorker = body . options ?. lockToVersion
92
94
? await tx . backgroundWorker . findUnique ( {
93
95
where : {
You can’t perform that action at this time.
0 commit comments