Closed ThinksFast closed 1 year ago
saq is designed to run it's own process. you can do saq.worker.start
i've never run saq directly inside an asgi worker, i know there's a library that does this
check out the usage here
OP issue is that the signals are handled by the worker and not propagated, so the worker does shut down, but the process managing the worker doesn't get the shutdown signal.
Subclassing the worker to prevent registration of the signal handlers does the trick:
class Worker(saq.Worker):
SIGNALS: list[Signals] = []
Hi, I am trying to use
saq
in an ASGI framework calledstarlite
. I'm struggling to get a basic SAQ implementation working smoothly.Below is a minimal example where the worker gets started and the job gets scheduled, but during shutdown, the code hangs. It seems like the jobs don't get aborted or cleaned up.
Can you help suggest a working configuration?
Python Requirements:
Save file as
main.py
and run using:uvicorn main:app