-
Notifications
You must be signed in to change notification settings - Fork 913
-
Notifications
You must be signed in to change notification settings - Fork 913
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
Worker Blocks When Concurrency Is Set To 0 #535
Comments
Set it to max int as a workaround perhaps until the maintainers can get to you |
Which broker are you using ? I've faced the same issue using Redis broker and after some digging in the code I've found out that the concurrency is set to 1 if < 1
The documentation however points out that :
Maybe we should update the documentation |
|
@henripqt I was using the Redis broker as well. I hope they'll allow |
According to the README: > Use the second parameter of `server.NewWorker` to limit the number of concurrently running > worker.Process() calls (per worker). Example: 1 will serialize task execution while 0 makes > the number of concurrently executed tasks unlimited (default). This change will set the concurrency to 2 * num CPUs when concurrency = 0. While it isn't "unlimited", it is neverthe a practical choice for most workloads (mixed CPU, I/O) and better than 1. This change should make the behavior more consistent with the doc. Should also fix #535 Co-authored-by: Charles Chan <charles.wh.chan@users.noreply.github.com> Co-authored-by: Richard Knop <RichardKnop@users.noreply.github.com>
I just played a bit with the example and found a strange behavior, that I can't make sense of and that is described differently in the docs.
This is stated in the docs, so I would assume that
add
returns first, as both are executed concurrently, butsleep
sleeps for two seconds, whileadd
returns immediatly.However, when looking at the logs,
sleep
is executed first (as expected), but blocks until finished, makingadd
return last.Logs:
However, if I change the second parameter of
server.NewWorker
to2
or higher, they are executed concurrently, andadd
returns first, as one would expect.Logs:
Am I missing something? If so, what is the correct way to allow for unlimited concurrent tasks?
The text was updated successfully, but these errors were encountered: