Understand the Multi-Job Queue System
mainThe 8mb.local queue system enables multiple users to submit video compression jobs simultaneously. It uses a distributed architecture to manage parallel processing, live progress tracking, and job state management.
Core Components
- Redis: Stores job metadata and handles SSE (Server-Sent Events) pub/sub.
- Celery: Manages the distributed task queue.
- FastAPI: Provides the REST API and SSE streaming endpoints.
Job Lifecycle
- Submission: A job is submitted via
/api/compress. - Metadata Creation: Backend creates metadata in Redis (
job:{task_id}) and adds the job to thejobs:activesorted set. - Processing: A Celery worker picks up the job based on available concurrency.
- Progress: The worker publishes real-time updates via Redis pub/sub.
- Completion: Once finished, the job remains visible in the queue for 1 hour before being cleaned up.