-
Notifications
You must be signed in to change notification settings - Fork 414
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(dynamic-rate-limit): validate job lock cases #2975
Conversation
@@ -1387,13 +1387,11 @@ export class Scripts { | |||
*/ | |||
async moveJobFromActiveToWait(jobId: string, token: string) { | |||
const client = await this.queue.client; | |||
const lockKey = `${this.queue.toKey(jobId)}:lock`; |
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.
why can't we generate the key here?
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.
removeLock include concats lock suffix to jobKey that is passed as an argv, so no need to pass lockKey
local pttl = rcall("PTTL", KEYS[7]) | ||
if lockToken == token then | ||
local metaKey = KEYS[6] | ||
if rcall("EXISTS", jobKey) == 1 then |
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.
I think we should be able to skip checking for the key existence as we need to read the token anyway, and it will return an empty string or nil if the key does not exist.
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.
as we don't expose this method to be used when using manual processing we should be good skipping it. For other methods like moveToComplete or moveToFailed is still needed as when passing token '0' we basically ignore that check
4cdb8a9
to
8e0214f
Compare
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.
LGTM
## [5.34.5](v5.34.4...v5.34.5) (2024-12-25) ### Bug Fixes * **dynamic-rate-limit:** validate job lock cases ([#2975](#2975)) ([8bb27ea](8bb27ea))
Validate existente of job when dynamic rate límit is used. Upgrade cron-parser to fix a vulnerability as well