Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix remaning->remaining typo #377

Merged
merged 1 commit into from May 25, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 7 additions & 6 deletions src/plugins/Retry.ts
Expand Up @@ -37,17 +37,17 @@ export class Retry extends Plugin {
return true;
}

const remaning = await this.attemptUp();
const remaining = await this.attemptUp();
await this.saveLastError();

if (remaning <= 0) {
if (remaining <= 0) {
await this.cleanup();
throw this.worker.error;
}

let nextTryDelay = this.options.retryDelay;
if (Array.isArray(this.options.backoffStrategy)) {
let index = this.options.retryLimit - remaning - 1;
let index = this.options.retryLimit - remaining - 1;
if (index > this.options.backoffStrategy.length - 1) {
index = this.options.backoffStrategy.length - 1;
}
Expand All @@ -64,7 +64,8 @@ export class Retry extends Plugin {
this.job.args = this.args;
this.worker.emit("reEnqueue", this.queue, this.job, {
delay: nextTryDelay,
remaningAttempts: remaning,
remaningAttempts: remaining, // @deprecated
remainingAttempts: remaining,
err: this.worker.error,
});

Expand Down Expand Up @@ -129,8 +130,8 @@ export class Retry extends Plugin {
await this.redis().setnx(key, -1);
const retryCount = await this.redis().incr(key);
await this.redis().expire(key, this.maxDelay());
const remaning = this.options.retryLimit - retryCount - 1;
return remaning;

return this.options.retryLimit - retryCount - 1;
}

async saveLastError() {
Expand Down