-
Notifications
You must be signed in to change notification settings - Fork 354
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
perf(priority): change priority as a new state #1984
Changes from 30 commits
193b92a
d0b196e
0f87cf8
d42e66c
f386db6
6b77001
0f98015
18b3c1d
499017f
933dc97
5c3db07
e36049c
be80d90
b28fa1b
fb73c30
220e0a4
f535033
0be0c0b
bbf3afb
a5de7da
fab6b3a
527eef5
9020413
acd0fef
3d3a8e3
ab92413
570ef51
6f20687
8fc8fb7
4f069c6
070af22
6d13180
0a53a05
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -429,7 +429,7 @@ export class Job< | |
* | ||
* @param data - the data that will replace the current jobs data. | ||
*/ | ||
update(data: DataType): Promise<void> { | ||
updateData(data: DataType): Promise<void> { | ||
this.data = data; | ||
|
||
return this.scripts.updateData<DataType, ReturnType, NameType>(this, data); | ||
|
@@ -551,7 +551,7 @@ export class Job< | |
); | ||
|
||
const result = await this.scripts.moveToFinished(this.id, args); | ||
this.finishedOn = args[13] as number; | ||
this.finishedOn = args[14] as number; | ||
|
||
return result; | ||
} | ||
|
@@ -632,7 +632,7 @@ export class Job< | |
fetchNext, | ||
); | ||
(<any>multi).moveToFinished(args); | ||
finishedOn = args[13]; | ||
finishedOn = args[14]; | ||
command = 'failed'; | ||
} | ||
|
||
|
@@ -1085,6 +1085,16 @@ export class Job< | |
); | ||
} | ||
|
||
if (this.opts.priority) { | ||
if (Math.trunc(this.opts.priority) !== this.opts.priority) { | ||
throw new Error(`Priority should not be float`); | ||
} | ||
|
||
if (this.opts.priority > 2097152) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can assign this constant to a const and also use the exponential operator: 2**21 (so that it is more clear why that number) |
||
throw new Error(`Priority should not be greater than 2097152`); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The error should say: Priority should be between 0 and 2097152. |
||
} | ||
} | ||
|
||
return this.scripts.addJob( | ||
client, | ||
jobData, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
more descriptive name