fix: patch _install_signal_handlers on RQ worker to run inside background thread
Browse files- app/main.py +3 -1
app/main.py
CHANGED
|
@@ -72,8 +72,10 @@ async def startup_event():
|
|
| 72 |
try:
|
| 73 |
conn = redis.Redis.from_url(settings.REDIS_URL)
|
| 74 |
worker = Worker([Queue("default", connection=conn)], connection=conn)
|
|
|
|
|
|
|
| 75 |
logger.info("Starting RQ background worker...")
|
| 76 |
-
worker.work(with_scheduler=True
|
| 77 |
except Exception as e:
|
| 78 |
logger.error(f"Failed to start RQ background worker: {e}")
|
| 79 |
|
|
|
|
| 72 |
try:
|
| 73 |
conn = redis.Redis.from_url(settings.REDIS_URL)
|
| 74 |
worker = Worker([Queue("default", connection=conn)], connection=conn)
|
| 75 |
+
# Patch signal handler installation to prevent thread errors
|
| 76 |
+
worker._install_signal_handlers = lambda *args, **kwargs: None
|
| 77 |
logger.info("Starting RQ background worker...")
|
| 78 |
+
worker.work(with_scheduler=True)
|
| 79 |
except Exception as e:
|
| 80 |
logger.error(f"Failed to start RQ background worker: {e}")
|
| 81 |
|