Skip to content

Commit

Permalink
fix(scheduler): remove deprecation warning on immediately option (#2923)
Browse files Browse the repository at this point in the history
  • Loading branch information
roggervalf authored Nov 23, 2024
1 parent bf03f86 commit 14ca7f4
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/classes/queue-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { RedisConnection } from './redis-connection';
import { Job } from './job';
import { KeysMap, QueueKeys } from './queue-keys';
import { Scripts } from './scripts';
import { TelemetryAttributes, SpanKind } from '../enums';
import { SpanKind } from '../enums';

/**
* @class QueueBase
Expand Down
2 changes: 1 addition & 1 deletion src/classes/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ export class Worker<
private waiting: Promise<number> | null = null;
private _repeat: Repeat; // To be deprecated in v6 in favor of Job Scheduler

private _jobScheduler: JobScheduler;
protected _jobScheduler: JobScheduler;

protected paused: Promise<void>;
protected processFn: Processor<DataType, ResultType, NameType>;
Expand Down
3 changes: 0 additions & 3 deletions src/interfaces/repeat-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ export interface RepeatOptions extends Omit<ParserOptions, 'iterator'> {
/**
* Repeated job should start right now
* ( work only with every settings)
*
* @deprecated
*
*/
immediately?: boolean;

Expand Down
3 changes: 1 addition & 2 deletions tests/test_telemetry_interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { expect, assert } from 'chai';
import { default as IORedis } from 'ioredis';
import { after, beforeEach, describe, it, before } from 'mocha';
import { v4 } from 'uuid';
import { FlowProducer, Queue, Worker } from '../src/classes';
import { FlowProducer, JobScheduler, Queue, Worker } from '../src/classes';
import { removeAllQueueData } from '../src/utils';
import {
Telemetry,
Expand All @@ -16,7 +16,6 @@ import {
} from '../src/interfaces';
import * as sinon from 'sinon';
import { SpanKind, TelemetryAttributes } from '../src/enums';
import { JobScheduler } from '../src/classes/job-scheduler';

describe('Telemetry', () => {
type ExtendedException = Exception & {
Expand Down
14 changes: 9 additions & 5 deletions tests/test_worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -482,16 +482,20 @@ describe('workers', function () {
// Add spy to worker.moveToActive
const spy = sinon.spy(worker, 'moveToActive');
const bclientSpy = sinon.spy(
await worker.blockingConnection.client,
await (worker as any).blockingConnection.client,
'bzpopmin',
);

for (let i = 0; i < numJobs; i++) {
const job = await queue.add('test', { foo: 'bar' });
expect(job.id).to.be.ok;
expect(job.data.foo).to.be.eql('bar');
const jobsData: { name: string; data: any }[] = [];
for (let j = 0; j < numJobs; j++) {
jobsData.push({
name: 'test',
data: { foo: 'bar' },
});
}

await queue.addBulk(jobsData);

expect(bclientSpy.callCount).to.be.equal(1);

await new Promise<void>((resolve, reject) => {
Expand Down

0 comments on commit 14ca7f4

Please sign in to comment.