Background Jobs¶
Autofile uses Valkey-backed background jobs for document processing work.
Valkey¶
The API connects to Valkey through REDIS_URL. The Docker Compose stack provides a Valkey service automatically.
Job Queues¶
The API starts in-process workers for fast, medium, and slow jobs. These queues let Autofile process document-related work without blocking normal API requests.
Processing Work¶
Background jobs handle work such as preview generation, text extraction, OCR, thumbnails, and document page processing.
Virus Scan Job¶
When an upload requests virus scanning, the API stores the file and enqueues a virus scan job instead of the normal post-upload processing jobs. The worker marks the file scanning, streams the stored object to the configured clamd endpoint, and records the verdict:
cleanenqueues the normal page-processing and thumbnail jobs for the file.infectedblocks the file without enqueueing further processing.- Scan failures mark the file
scan_errorunder the fail-closed policy (ornot_requiredunder the fail-open policy, which then enqueues normal processing).
If post-upload enqueueing fails after a clean scan, the file is reset to scan_error so the next retry can recover instead of leaving it stuck. ClamAV signature databases are large and take time to initialize, so avoid sending scan jobs to ClamAV before it is ready.
Operations¶
If document processing appears stuck, check:
- The API logs.
- Valkey connectivity.
- S3 bucket access.