Hi there! Is there a recommended way to dynamically pause/unpause workers in a multi-instance scenario? I would like to avoid a push approach (telling each individual instance to stop) in favor of a pull one (each instance consults some shared state that tells them to stop consuming).
That's an interesting use-case. There is no hook or mechanism at the moment for stopping or pausing the polling threads other than stopping the worker. You could implement the pull approach from "the outside" by having some mechanism that consults the shared state and stops/starts workers based on whatever logic you implement.
interesting! I'll try that out
I've seen your comment on the o11y/instrumentation issue, btw. I have done some exploratory design, but there is a lot to think about, and little time. 😅
I'm definitely down to help with some pull requests if we can agree on a particular design. Or just some exploratory prs to validate the idea. We picked up proletarian recently at our company and it's been really helpful!
My use case is stopping consumers in emergency situations (e.g. an incident). It would need to happen fast (can't wait for a full application deployment) and reliably (e.g. can't expect all instances to be accessible via an ip to respond to a request).
My instinct would be to set a flag in some shared store (e.g. redis, or even a specific postgres table) and have the workers read from it when polling
A more hackish solution would be to update jobs in the db to be consumed in the far future, and then reset the dates when consumers need to unpause