Skip to content

Commit

Permalink
fix(job-scheduler): omit deduplication and debounce options from temp…
Browse files Browse the repository at this point in the history
…late options (#2960)
  • Loading branch information
roggervalf authored Dec 10, 2024
1 parent ab437a7 commit b5fa6a3
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 6 deletions.
8 changes: 6 additions & 2 deletions src/classes/job-scheduler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ import {
RepeatBaseOptions,
RepeatOptions,
} from '../interfaces';
import { JobsOptions, RepeatStrategy } from '../types';
import {
JobSchedulerTemplateOptions,
JobsOptions,
RepeatStrategy,
} from '../types';
import { Job } from './job';
import { QueueBase } from './queue-base';
import { RedisConnection } from './redis-connection';
Expand All @@ -32,7 +36,7 @@ export class JobScheduler extends QueueBase {
repeatOpts: Omit<RepeatOptions, 'key' | 'prevMillis' | 'offset'>,
jobName: N,
jobData: T,
opts: Omit<JobsOptions, 'jobId' | 'repeat' | 'delay'>,
opts: JobSchedulerTemplateOptions,
{ override }: { override: boolean },
): Promise<Job<T, R, N> | undefined> {
const { every, pattern } = repeatOpts;
Expand Down
9 changes: 7 additions & 2 deletions src/classes/queue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@ import {
RepeatableJob,
RepeatOptions,
} from '../interfaces';
import { FinishedStatus, JobsOptions, MinimalQueue } from '../types';
import {
FinishedStatus,
JobsOptions,
JobSchedulerTemplateOptions,
MinimalQueue,
} from '../types';
import { Job } from './job';
import { QueueGetters } from './queue-getters';
import { Repeat } from './repeat';
Expand Down Expand Up @@ -433,7 +438,7 @@ export class Queue<
jobTemplate?: {
name?: NameType;
data?: DataType;
opts?: Omit<JobsOptions, 'jobId' | 'repeat' | 'delay'>;
opts?: JobSchedulerTemplateOptions;
},
) {
if (repeatOpts.endDate) {
Expand Down
4 changes: 2 additions & 2 deletions src/interfaces/job-scheduler-json.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { JobsOptions } from '../types';
import { JobSchedulerTemplateOptions } from '../types';

export interface JobSchedulerTemplateJson<D = any> {
data?: D;
opts?: Omit<JobsOptions, 'jobId' | 'repeat' | 'delay'>;
opts?: JobSchedulerTemplateOptions;
}

export interface JobSchedulerJson<D = any> {
Expand Down
1 change: 1 addition & 0 deletions src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ export * from './finished-status';
export * from './minimal-queue';
export * from './job-json-sandbox';
export * from './job-options';
export * from './job-scheduler-template-options';
export * from './job-type';
export * from './repeat-strategy';
6 changes: 6 additions & 0 deletions src/types/job-scheduler-template-options.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { JobsOptions } from './job-options';

export type JobSchedulerTemplateOptions = Omit<
JobsOptions,
'jobId' | 'repeat' | 'delay' | 'deduplication' | 'debounce'
>;

0 comments on commit b5fa6a3

Please sign in to comment.