-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathworker.py
More file actions
23 lines (16 loc) · 758 Bytes
/
Copy pathworker.py
File metadata and controls
23 lines (16 loc) · 758 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
"""RQ worker entrypoint for webhook delivery jobs."""
from __future__ import annotations
from rq import Connection, Worker
from app.config import get_settings
from app.services.webhook_service import get_webhook_queue, get_webhook_redis_connection
def main() -> None:
"""Start one RQ worker bound to the configured webhook queue."""
settings = get_settings()
queue = get_webhook_queue()
with Connection(get_webhook_redis_connection()):
# Keep each blocking dequeue window below common managed-Redis idle
# timeouts so the worker does not exit during quiet periods.
worker = Worker([queue.name], default_worker_ttl=settings.webhook.worker_ttl_seconds)
worker.work()
if __name__ == "__main__":
main()