Skip to content

Commit 385fd31

Browse files
committed
tell run to exit before force requeue
1 parent 6f6cbd0 commit 385fd31

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import { CreateCheckpointService } from "./createCheckpoint.server";
3131
import { FinalizeTaskRunService } from "./finalizeTaskRun.server";
3232
import { RetryAttemptService } from "./retryAttempt.server";
3333
import { getTaskEventStoreTableForRun } from "../taskEventStore.server";
34+
import { socketIo } from "../handleSocketIo.server";
3435

3536
type FoundAttempt = Awaited<ReturnType<typeof findAttempt>>;
3637

@@ -504,6 +505,14 @@ export class CompleteAttemptService extends BaseService {
504505

505506
if (forceRequeue) {
506507
logger.debug("[CompleteAttemptService] Forcing retry via queue", { runId: run.id });
508+
509+
// The run won't know it should shut down as we make the decision to force requeue here
510+
// This also ensures that this change is backwards compatible with older workers
511+
socketIo.coordinatorNamespace.emit("REQUEST_RUN_CANCELLATION", {
512+
version: "v1",
513+
runId: run.id,
514+
});
515+
507516
await retryViaQueue();
508517
return;
509518
}

0 commit comments

Comments
 (0)