File tree Expand file tree Collapse file tree 5 files changed +15
-24
lines changed
internal-packages/run-engine/src/engine Expand file tree Collapse file tree 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(
264264 prisma : PrismaClientOrTransaction ,
265265 environmentId : string
266266) : Promise < WorkerDeploymentWithWorkerTasks | null > {
267- // TODO: fixme
268- const promotion = await prisma . workerDeploymentPromotion . findUnique ( {
267+ const promotion = await prisma . workerDeploymentPromotion . findFirst ( {
269268 where : {
270- environmentId_label : {
271- environmentId,
272- label : CURRENT_DEPLOYMENT_LABEL ,
273- } ,
269+ environmentId,
270+ label : CURRENT_DEPLOYMENT_LABEL ,
274271 } ,
275272 include : {
276273 deployment : {
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ export class BatchSystem {
3434 */
3535 async #tryCompleteBatch( { batchId } : { batchId : string } ) {
3636 return startSpan ( this . $ . tracer , "#tryCompleteBatch" , async ( span ) => {
37- const batch = await this . $ . prisma . batchTaskRun . findUnique ( {
37+ const batch = await this . $ . prisma . batchTaskRun . findFirst ( {
3838 select : {
3939 status : true ,
4040 runtimeEnvironmentId : true ,
Original file line number Diff line number Diff line change @@ -139,12 +139,10 @@ export class RunAttemptSystem {
139139 throw new ServiceValidationError ( "Task run is not locked" , 400 ) ;
140140 }
141141
142- const queue = await prisma . taskQueue . findUnique ( {
142+ const queue = await prisma . taskQueue . findFirst ( {
143143 where : {
144- runtimeEnvironmentId_name : {
145- runtimeEnvironmentId : environment . id ,
146- name : taskRun . queue ,
147- } ,
144+ runtimeEnvironmentId : environment . id ,
145+ name : taskRun . queue ,
148146 } ,
149147 } ) ;
150148
@@ -1199,7 +1197,7 @@ export class RunAttemptSystem {
11991197
12001198 async #getAuthenticatedEnvironmentFromRun( runId : string , tx ?: PrismaClientOrTransaction ) {
12011199 const prisma = tx ?? this . $ . prisma ;
1202- const taskRun = await prisma . taskRun . findUnique ( {
1200+ const taskRun = await prisma . taskRun . findFirst ( {
12031201 where : {
12041202 id : runId ,
12051203 } ,
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ export class TtlSystem {
3333 }
3434
3535 //only expire "PENDING" runs
36- const run = await prisma . taskRun . findUnique ( { where : { id : runId } } ) ;
36+ const run = await prisma . taskRun . findFirst ( { where : { id : runId } } ) ;
3737
3838 if ( ! run ) {
3939 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 {
159159 const prisma = tx ?? this . $ . prisma ;
160160
161161 const existingWaitpoint = idempotencyKey
162- ? await prisma . waitpoint . findUnique ( {
162+ ? await prisma . waitpoint . findFirst ( {
163163 where : {
164- environmentId_idempotencyKey : {
165- environmentId,
166- idempotencyKey,
167- } ,
164+ environmentId,
165+ idempotencyKey,
168166 } ,
169167 } )
170168 : undefined ;
@@ -241,12 +239,10 @@ export class WaitpointSystem {
241239 tags ?: string [ ] ;
242240 } ) : Promise < { waitpoint : Waitpoint ; isCached : boolean } > {
243241 const existingWaitpoint = idempotencyKey
244- ? await this . $ . prisma . waitpoint . findUnique ( {
242+ ? await this . $ . prisma . waitpoint . findFirst ( {
245243 where : {
246- environmentId_idempotencyKey : {
247- environmentId,
248- idempotencyKey,
249- } ,
244+ environmentId,
245+ idempotencyKey,
250246 } ,
251247 } )
252248 : undefined ;
You can’t perform that action at this time.
0 commit comments