-
-
Notifications
You must be signed in to change notification settings - Fork 199
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
All concurrency controlled jobs throw exceptions and are rescheduled if they are called using perform_now #591
Comments
@pgvsalamander thank you for opening the issue! I think this is a bug to be fixed. I went searching to see if there was previous discussion about how the Concurrency extension should interact with Because Rails' And regardless of that, when you describe the Concurrency extension always throwing an extension that is clearly not right and I will fix that. |
I think that makes sense as well. However, perhaps an INFO or DEBUG level log along the lines of "Skipping concurrency checks - concurrency restrictions are not enforced with perform_now" to alert users in development? |
I would expect that it would bypass the total and enqueue limits, but would respect the perform_limit and block until it can run without exceeding the limit. That said, I imagine trying to enforce perform_limit on a job that doesn't exist in the database and therefore can't be seen by the rest of the runners would be very difficult, to the point where it's probably not worth the trouble to implement. |
I'm having trouble reproducing the exact behavior observed, but I still think there's a bug. Documenting this for future reference.
|
huh, I guess that shouldn't have been unexpected to me given I made this contribution to Rails 😅 : rails/rails#43434 Which maybe changes my thinking about how this should work. What about this instead?: When using I'm still not happy about the the "will be enqueued" part because I think that somewhat violates my expected contract for |
This is the behavior I was trying to describe, I just did a bad job explaining it. (Pun not intended!)
This seems like the best solution for now. Would you be open to a PR adding the option to block on perform_now until it can run without exceeding the concurrency count? (If I ever get around to it) I'd imagine it being something that can be enabled on an entire job class, or on a particular instance ( |
I've slept on this a few times, and I think I'm going to go back to my more conservative proposal of ignoring concurrency controls entirely on |
Any job that includes the
GoodJob::ActiveJobExtensions::Concurrency
concurrency extension always throwsGoodJob::ActiveJobExtensions::Concurrency::ConcurrencyExceededError
when it is called using perform_now, regardless of if there are any other jobs with matching concurrency keys. This behavior occurs regardless of if perform_now is called in a rake task or in a controller.Is this expected/known behavior? My first guess would be that something about the way concurrency works requires that the jobs be run by background workers, but I haven't seen anything in the documentation that would suggest it.
Tested on Ruby 2.6.5, Rails 6.1.5.1, GoodJob 2.14.2
The text was updated successfully, but these errors were encountered: