Skip to content

Commit a66db33

Browse files
committed
If there’s no attempt and no worker when finalizing a run, don’t try to create an attempt
1 parent f90e23d commit a66db33

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,14 +122,22 @@ export class FinalizeTaskRunService extends BaseService {
122122
error,
123123
});
124124

125+
if (!run.lockedById) {
126+
logger.error(
127+
"FinalizeTaskRunService: No lockedById, so can't get the BackgroundWorkerTask. Not creating an attempt.",
128+
{ runId: run.id }
129+
);
130+
return;
131+
}
132+
125133
const workerTask = await this._prisma.backgroundWorkerTask.findFirst({
126134
select: {
127135
id: true,
128136
workerId: true,
129137
runtimeEnvironmentId: true,
130138
},
131139
where: {
132-
id: run.lockedById!,
140+
id: run.lockedById,
133141
},
134142
});
135143

0 commit comments

Comments
 (0)