Jobs Queue
This module implements a retry-safe background job queue powered entirely by Odoo's native scheduled action (ir.cron), eliminating the need for extra workers or external infrastructure. When jobs are enqueued, the system creates an isolated database cursor within the cron execution context to prevent transaction conflicts with the main thread. Each job's method and arguments are stored as a serialized string, which can be modified or enriched with parameters like retry counts and priorities before execution. The queue automatically retries failed jobs on subsequent cron cycles, persists execution logs for auditing, and allows manual string modifications through the backend interface. This design offloads long-running tasks to the background, improving system responsiveness while maintaining full visibility and control over job processing.
KEY HIGHLIGHTS
Async Processing
Non-blocking background job queue and automatic cron trigger.
Automatic Retry
Exponential backoff with configurable attempts and retryable error detection (deadlocks, serialization failures).
Transaction Safety
Each job runs in its own transaction with SKIP LOCKED for safe concurrent processing and stuck job detection.
Failure Handling
Automatic activity scheduling and message posting on failure with manual requeue/cancel options.
Configurable
System parameters for batch limits, max attempts, stuck timeouts, and backoff cap with sensible defaults.
Audit Trail
Complete job lifecycle tracking with states, attempts, duration, and error logs.
Configuration & Job Management
System Parameters Configuration
Configure essential job queue parameters including batch processing limits,
maximum retry attempts, stuck job detection timeouts, and exponential backoff
cap to optimize performance based on your business requirements.
Real-time Job Monitoring & Management
Monitor all background jobs with real-time status updates including pending,
running, retry, done, failed, and cancelled states. Jobs that fail after
maximum retry attempts can be manually requeued by administrators for
immediate reprocessing without data loss.
Create Background Jobs
Easily create background jobs by specifying the target model and method name
to be executed asynchronously. Jobs can be configured with optional record IDs,
arguments, keyword arguments, and priority levels for flexible task scheduling.
Please log in to comment on this module