Dramatiq Worker Timeout

117 Views Asked by At

I’m im new to using Dramatiq. May I ask if there is any way to set the Dramatiq worker’s timeout from Dramatiq CLI (the number of milliseconds workers should wake up after if the queue is idle). Currently it is default to 1000 ms which is 1second. It is causing latency for workers to pick up new tasks.

https://dramatiq.io/reference.html#workers

I see that Worker is created in Dramatiq/cli.py worker_process, but not way to specify the worker_timeout field.

1

There are 1 best solutions below

0
Sin Han Jinn On

I found this in the documentation within the unit testing section.

def stub_worker():
    worker = Worker(broker, worker_timeout=100)
    worker.start()
    yield worker
    worker.stop()

You can try changing the worker_timeout for the wakeup interval