Closed juledwar closed 3 years ago
It looks like I should just create a new Engine per queue type with the current code.
Also, given that I am using the flask_spinach extension this doesn't look particularly straightforward!
Yes, not being able to call start_workers multiple times on the same engine is intentional. The engine holds a reference to one pool of workers.
As you figured, using bare Spinach it is possible to create two brokers and two engines in the same process but the Flask/Spinach integration assumes one Flask app has one Spinach engine, so it will be tough.
Perhaps we could allow mixing of queue names in the initial call? Although from eyeballing the code that seems rather difficult also as all the Workers
share the same queue name.
Closing this one as the design is intentional. Feel free to open another issue to discuss improving the flexibility of queues, if needed.
That's fair. I did work around it by avoiding the existing Flask extension, which I think is where someone should look first if they want to fix this.
I want to have worker threads for different queues all running in the same process. To do this I did something like:
However the second call is rejected with
RuntimeError('Workers are already running')
Is this something that I can fix or is it entirely intentional to block further workers on different queues for some reason I can't see?