feat(backend): implement postgres job queue

This commit is contained in:
2026-06-21 01:39:32 +03:30
parent d95f3c27c1
commit 24a025587e
29 changed files with 1466 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
import logging
import signal
from django.core.management.base import BaseCommand
from jobs.worker import JobWorkerRunner
logger = logging.getLogger(__name__)
class Command(BaseCommand):
help = "Run the configured threaded job worker."
def handle(self, *args, **options):
logging.basicConfig(level=logging.INFO, format="%(asctime)s %(levelname)s %(name)s %(message)s")
runner = JobWorkerRunner()
signal.signal(signal.SIGINT, runner.request_stop)
signal.signal(signal.SIGTERM, runner.request_stop)
self.stdout.write(self.style.SUCCESS(f"Starting {runner.thread_count} job worker thread(s)."))
runner.run_forever()
self.stdout.write(self.style.SUCCESS("Job worker stopped."))