Skip to content

Commit

Permalink
chore: update upsertJobScheduler to use Omit for stricter field valid…
Browse files Browse the repository at this point in the history
…ation
  • Loading branch information
manast authored and roggervalf committed Oct 4, 2024
1 parent 061c4a7 commit e1516ff
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
9 changes: 2 additions & 7 deletions src/classes/job-scheduler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ export class JobScheduler extends QueueBase {

async upsertJobScheduler<T = any, R = any, N extends string = string>(
jobSchedulerId: string,
repeatOpts: RepeatOptions,
repeatOpts: Omit<RepeatOptions, 'key'>,
jobName: N,
jobData: T,
opts: JobsOptions,
opts: Omit<JobsOptions, 'jobId' | 'repeat' | 'delay'>,
{ override }: { override: boolean },
): Promise<Job<T, R, N> | undefined> {
// Check if we reached the limit of the repeatable job's iterations
Expand Down Expand Up @@ -66,11 +66,6 @@ export class JobScheduler extends QueueBase {
);
const offset = hasImmediately && every ? now - nextMillis : undefined;
if (nextMillis) {
// We store the undecorated opts.jobId into the repeat options
if (!prevMillis && opts.jobId) {
repeatOpts.jobId = opts.jobId;
}

if (override) {
await this.scripts.addJobScheduler(jobSchedulerId, nextMillis, {
name: jobName,
Expand Down
2 changes: 1 addition & 1 deletion src/classes/queue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ export class Queue<
jobTemplate?: {
name?: NameType;
data?: DataType;
opts?: Omit<JobsOptions, 'repeat'>;
opts?: Omit<JobsOptions, 'jobId' | 'repeat' | 'delay'>;
},
) {
if (repeatOpts.endDate) {
Expand Down

0 comments on commit e1516ff

Please sign in to comment.