File tree 5 files changed +15
-24
lines changed
internal-packages/run-engine/src/engine
5 files changed +15
-24
lines changed Original file line number Diff line number Diff line change @@ -264,13 +264,10 @@ export async function getManagedWorkerFromCurrentlyPromotedDeployment(
264
264
prisma : PrismaClientOrTransaction ,
265
265
environmentId : string
266
266
) : Promise < WorkerDeploymentWithWorkerTasks | null > {
267
- // TODO: fixme
268
- const promotion = await prisma . workerDeploymentPromotion . findUnique ( {
267
+ const promotion = await prisma . workerDeploymentPromotion . findFirst ( {
269
268
where : {
270
- environmentId_label : {
271
- environmentId,
272
- label : CURRENT_DEPLOYMENT_LABEL ,
273
- } ,
269
+ environmentId,
270
+ label : CURRENT_DEPLOYMENT_LABEL ,
274
271
} ,
275
272
include : {
276
273
deployment : {
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ export class BatchSystem {
34
34
*/
35
35
async #tryCompleteBatch( { batchId } : { batchId : string } ) {
36
36
return startSpan ( this . $ . tracer , "#tryCompleteBatch" , async ( span ) => {
37
- const batch = await this . $ . prisma . batchTaskRun . findUnique ( {
37
+ const batch = await this . $ . prisma . batchTaskRun . findFirst ( {
38
38
select : {
39
39
status : true ,
40
40
runtimeEnvironmentId : true ,
Original file line number Diff line number Diff line change @@ -139,12 +139,10 @@ export class RunAttemptSystem {
139
139
throw new ServiceValidationError ( "Task run is not locked" , 400 ) ;
140
140
}
141
141
142
- const queue = await prisma . taskQueue . findUnique ( {
142
+ const queue = await prisma . taskQueue . findFirst ( {
143
143
where : {
144
- runtimeEnvironmentId_name : {
145
- runtimeEnvironmentId : environment . id ,
146
- name : taskRun . queue ,
147
- } ,
144
+ runtimeEnvironmentId : environment . id ,
145
+ name : taskRun . queue ,
148
146
} ,
149
147
} ) ;
150
148
@@ -1199,7 +1197,7 @@ export class RunAttemptSystem {
1199
1197
1200
1198
async #getAuthenticatedEnvironmentFromRun( runId : string , tx ?: PrismaClientOrTransaction ) {
1201
1199
const prisma = tx ?? this . $ . prisma ;
1202
- const taskRun = await prisma . taskRun . findUnique ( {
1200
+ const taskRun = await prisma . taskRun . findFirst ( {
1203
1201
where : {
1204
1202
id : runId ,
1205
1203
} ,
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ export class TtlSystem {
33
33
}
34
34
35
35
//only expire "PENDING" runs
36
- const run = await prisma . taskRun . findUnique ( { where : { id : runId } } ) ;
36
+ const run = await prisma . taskRun . findFirst ( { where : { id : runId } } ) ;
37
37
38
38
if ( ! run ) {
39
39
this . $ . logger . debug ( "Could not find enqueued run to expire" , {
Original file line number Diff line number Diff line change @@ -159,12 +159,10 @@ export class WaitpointSystem {
159
159
const prisma = tx ?? this . $ . prisma ;
160
160
161
161
const existingWaitpoint = idempotencyKey
162
- ? await prisma . waitpoint . findUnique ( {
162
+ ? await prisma . waitpoint . findFirst ( {
163
163
where : {
164
- environmentId_idempotencyKey : {
165
- environmentId,
166
- idempotencyKey,
167
- } ,
164
+ environmentId,
165
+ idempotencyKey,
168
166
} ,
169
167
} )
170
168
: undefined ;
@@ -241,12 +239,10 @@ export class WaitpointSystem {
241
239
tags ?: string [ ] ;
242
240
} ) : Promise < { waitpoint : Waitpoint ; isCached : boolean } > {
243
241
const existingWaitpoint = idempotencyKey
244
- ? await this . $ . prisma . waitpoint . findUnique ( {
242
+ ? await this . $ . prisma . waitpoint . findFirst ( {
245
243
where : {
246
- environmentId_idempotencyKey : {
247
- environmentId,
248
- idempotencyKey,
249
- } ,
244
+ environmentId,
245
+ idempotencyKey,
250
246
} ,
251
247
} )
252
248
: undefined ;
You can’t perform that action at this time.
0 commit comments