-
-
Notifications
You must be signed in to change notification settings - Fork 210
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
Executing perform_now on a good_job with GoodJobs::ActiveJobExtensions::Concurrency can run twice #1335
Comments
This is intended or more specifically, there's nothing GoodJob can do about it. |
@bensheldon I realize you may not be able to detect when you are in the foreground, and when you are in the background. I'm not suggesting GoodJob should do any concurrency logic in that scenario; I'm just suggesting that something in GoodJob's concurrency mixin is in error, since the Job is executed twice. Removing the concurrency mixin does prevent the unexpected behavior of double execution. |
oh! sorry I misunderstood. I think you're saying it's something like this:
So that would imply that we need this change because the context of the - if CurrentThread.execution.blank?
+ if CurrentThread.execution.blank? || CurrentThread.execution.active_job_id != job_id
logger.debug("Ignoring concurrency limits because the job is executed with `perform_now`.")
next
end |
I think you better understand what I was getting at... the context is bleeding through. Is the fix that simple? |
Yep, I think it's that simple 😊 I made a PR: #1336 |
I just released (what I hope is) the fix in https://github.com/bensheldon/good_job/releases/tag/v3.28.1 |
Perfect! Thank you! |
Setup:
perform_now
:Expected Output:
TestJob runs once
Observed Output
TestJob runs twice, and the concurrency violation is observed:
The text was updated successfully, but these errors were encountered: