File tree 1 file changed +37
-4
lines changed
internal-packages/run-engine/src/engine/db 1 file changed +37
-4
lines changed Original file line number Diff line number Diff line change @@ -289,10 +289,43 @@ export async function getWorkerFromCurrentlyPromotedDeployment(
289
289
return null ;
290
290
}
291
291
292
+ if ( promotion . deployment . type === "MANAGED" ) {
293
+ // This is a run engine v2 deployment, so return it
294
+ return {
295
+ worker : promotion . deployment . worker ,
296
+ tasks : promotion . deployment . worker . tasks ,
297
+ queues : promotion . deployment . worker . queues ,
298
+ deployment : promotion . deployment ,
299
+ } ;
300
+ }
301
+
302
+ // We need to get the latest run engine v2 deployment
303
+ const latestV2Deployment = await prisma . workerDeployment . findFirst ( {
304
+ where : {
305
+ environmentId,
306
+ type : "MANAGED" ,
307
+ } ,
308
+ orderBy : {
309
+ id : "desc" ,
310
+ } ,
311
+ include : {
312
+ worker : {
313
+ include : {
314
+ tasks : true ,
315
+ queues : true ,
316
+ } ,
317
+ } ,
318
+ } ,
319
+ } ) ;
320
+
321
+ if ( ! latestV2Deployment ?. worker ) {
322
+ return null ;
323
+ }
324
+
292
325
return {
293
- worker : promotion . deployment . worker ,
294
- tasks : promotion . deployment . worker . tasks ,
295
- queues : promotion . deployment . worker . queues ,
296
- deployment : promotion . deployment ,
326
+ worker : latestV2Deployment . worker ,
327
+ tasks : latestV2Deployment . worker . tasks ,
328
+ queues : latestV2Deployment . worker . queues ,
329
+ deployment : latestV2Deployment ,
297
330
} ;
298
331
}
You can’t perform that action at this time.
0 commit comments