Skip to content

Commit

Permalink
feat(api): allow workflow trigger to specify a priority that's passed…
Browse files Browse the repository at this point in the history
… onto bullmq
  • Loading branch information
isaiahdahl committed Sep 18, 2024
1 parent 62f5211 commit 1ec9489
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IsDefined, IsString, IsOptional, ValidateNested, ValidateIf, IsEnum } from 'class-validator';
import { IsDefined, IsString, IsOptional, ValidateNested, ValidateIf, IsEnum, IsNumber } from 'class-validator';
import {
AddressingTypeEnum,
TriggerRecipients,
Expand Down Expand Up @@ -37,6 +37,10 @@ export class ParseEventRequestBaseCommand extends EnvironmentWithUserCommand {
@IsOptional()
@IsEnum(TriggerRequestCategoryEnum)
requestCategory?: TriggerRequestCategoryEnum;

@IsOptional()
@IsNumber()
priority?: number;
}

export class ParseEventRequestMulticastCommand extends ParseEventRequestBaseCommand {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,14 @@ export class ParseEventRequest {
transactionId,
};

await this.workflowQueueService.add({ name: transactionId, data: jobData, groupId: command.organizationId });
const options = process.env.IS_DOCKER_HOSTED === 'true' && command.priority ? { priority: command.priority } : {};

await this.workflowQueueService.add({
name: transactionId,
data: jobData,
groupId: command.organizationId,
...options,
});

return {
acknowledged: true,
Expand Down

0 comments on commit 1ec9489

Please sign in to comment.