Skip to content

Commit

Permalink
fix: extendlock,createbulk use pipeline no multi command
Browse files Browse the repository at this point in the history
Signed-off-by: adi_holden <adi@dragonflydb.io>
  • Loading branch information
adiholden authored and manast committed May 28, 2024
1 parent d3ad53f commit a053d9b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/classes/job.ts
Original file line number Diff line number Diff line change
Expand Up @@ -256,18 +256,18 @@ export class Job<
new this<T, R, N>(queue, job.name, job.data, job.opts, job.opts?.jobId),
);

const multi = client.multi();
const pipeline = client.pipeline();

for (const job of jobInstances) {
job.addJob(<RedisClient>(multi as unknown), {
job.addJob(<RedisClient>(pipeline as unknown), {
parentKey: job.parentKey,
parentDependenciesKey: job.parentKey
? `${job.parentKey}:dependencies`
: '',
});
}

const results = (await multi.exec()) as [null | Error, string][];
const results = (await pipeline.exec()) as [null | Error, string][];
for (let index = 0; index < results.length; ++index) {
const [err, id] = results[index];
if (err) {
Expand Down
6 changes: 3 additions & 3 deletions src/classes/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1004,16 +1004,16 @@ will never work with more accuracy than 1ms. */

protected async extendLocks(jobs: Job[]) {
try {
const multi = (await this.client).multi();
const pipeline = (await this.client).pipeline();
for (const job of jobs) {
await this.scripts.extendLock(
job.id,
job.token,
this.opts.lockDuration,
multi,
pipeline,
);
}
const result = (await multi.exec()) as [Error, string][];
const result = (await pipeline.exec()) as [Error, string][];

for (const [err, jobId] of result) {
if (err) {
Expand Down

0 comments on commit a053d9b

Please sign in to comment.