Skip to content

Commit fc59ce2

Browse files
committed
execution payload helper now with single object arg
1 parent 008de3b commit fc59ce2

File tree

4 files changed

+31
-20
lines changed

4 files changed

+31
-20
lines changed

apps/webapp/app/v3/failedTaskRun.server.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -146,12 +146,11 @@ export class FailedTaskRunService extends BaseService {
146146

147147
// We already have an attempt with non-final status, let's use it
148148
try {
149-
const executionPayload = await sharedQueueTasks.getExecutionPayloadFromAttempt(
150-
attempt.id,
151-
undefined,
152-
undefined,
153-
true
154-
);
149+
const executionPayload = await sharedQueueTasks.getExecutionPayloadFromAttempt({
150+
id: attempt.id,
151+
skipStatusChecks: true,
152+
});
153+
155154
return executionPayload?.execution;
156155
} catch (error) {
157156
logger.error("[FailedTaskRunService] Failed to get execution payload", {

apps/webapp/app/v3/handleSocketIo.server.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,10 @@ function createCoordinatorNamespace(io: Server) {
195195
const service = new CreateTaskRunAttemptService();
196196
const { attempt } = await service.call(message.runId, environment, false);
197197

198-
const payload = await sharedQueueTasks.getExecutionPayloadFromAttempt(attempt.id, true);
198+
const payload = await sharedQueueTasks.getExecutionPayloadFromAttempt({
199+
id: attempt.id,
200+
setToExecuting: true,
201+
});
199202

200203
if (!payload) {
201204
logger.error("Failed to retrieve payload after attempt creation", message);

apps/webapp/app/v3/marqs/sharedQueueConsumer.server.ts

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -718,9 +718,9 @@ export class SharedQueueConsumer {
718718

719719
completions.push(completion);
720720

721-
const executionPayload = await this._tasks.getExecutionPayloadFromAttempt(
722-
completedAttempt.id
723-
);
721+
const executionPayload = await this._tasks.getExecutionPayloadFromAttempt({
722+
id: completedAttempt.id,
723+
});
724724

725725
if (!executionPayload) {
726726
await this.#ackAndDoMoreWork(message.messageId);
@@ -942,12 +942,17 @@ class SharedQueueTasks {
942942
}
943943
}
944944

945-
async getExecutionPayloadFromAttempt(
946-
id: string,
947-
setToExecuting?: boolean,
948-
isRetrying?: boolean,
949-
skipStatusChecks?: boolean
950-
): Promise<ProdTaskRunExecutionPayload | undefined> {
945+
async getExecutionPayloadFromAttempt({
946+
id,
947+
setToExecuting,
948+
isRetrying,
949+
skipStatusChecks,
950+
}: {
951+
id: string;
952+
setToExecuting?: boolean;
953+
isRetrying?: boolean;
954+
skipStatusChecks?: boolean;
955+
}): Promise<ProdTaskRunExecutionPayload | undefined> {
951956
const attempt = await prisma.taskRunAttempt.findUnique({
952957
where: {
953958
id,
@@ -1153,7 +1158,11 @@ class SharedQueueTasks {
11531158
return;
11541159
}
11551160

1156-
return this.getExecutionPayloadFromAttempt(latestAttempt.id, setToExecuting, isRetrying);
1161+
return this.getExecutionPayloadFromAttempt({
1162+
id: latestAttempt.id,
1163+
setToExecuting,
1164+
isRetrying,
1165+
});
11571166
}
11581167

11591168
async getLazyAttemptPayload(

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -207,9 +207,9 @@ export class ResumeAttemptService extends BaseService {
207207

208208
completions.push(completion);
209209

210-
const executionPayload = await sharedQueueTasks.getExecutionPayloadFromAttempt(
211-
completedAttempt.id
212-
);
210+
const executionPayload = await sharedQueueTasks.getExecutionPayloadFromAttempt({
211+
id: completedAttempt.id,
212+
});
213213

214214
if (!executionPayload) {
215215
logger.error("Failed to get execution payload", {

0 commit comments

Comments
 (0)