-
Notifications
You must be signed in to change notification settings - Fork 8
PS-489 - prevent double queueing ai workflow runs #185
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -49,6 +49,18 @@ export class SubmissionScanCompleteOrchestrator { | |
| return; | ||
| } | ||
|
|
||
| // check if workflow runs have already been queued for this submission | ||
| const alreadyQueued = await this.workflowQueueHandler.hasQueuedWorkflowRuns( | ||
| submissionId, | ||
| ); | ||
|
|
||
| if (alreadyQueued) { | ||
| this.logger.log( | ||
| `AI workflow runs already queued for submission ${submissionId}. Skipping queueing.`, | ||
| ); | ||
| return; | ||
| } | ||
|
Comment on lines
+52
to
+62
|
||
|
|
||
| await this.workflowQueueHandler.queueWorkflowRuns( | ||
| challenge.workflows, | ||
| challenge.id, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -79,6 +79,18 @@ export class WorkflowQueueHandler implements OnModuleInit { | |
| }); | ||
| } | ||
|
|
||
| async hasQueuedWorkflowRuns(submissionId: string): Promise<boolean> { | ||
|
||
| if (!submissionId) return false; | ||
vas3a marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| const existing = await this.prisma.aiWorkflowRun.findFirst({ | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [ |
||
| where: { | ||
| submissionId, | ||
kkartunov marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }, | ||
| }); | ||
|
|
||
| return !!existing; | ||
| } | ||
|
|
||
| async handleQueuedWorkflowRun([job]: [Job]) { | ||
| this.logger.log(`Processing job ${job.id}`); | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.