Skip to content

Conversation

@imahmedismail
Copy link

Roadmap Implementation

This PR implements several key items from the project roadmap:

  • Delayed Jobs - Schedule jobs to run at specific times
  • Job Cancellation - Cancel pending jobs before execution
  • Job Priority - Priority-based job processing
  • Job Timeouts - Prevent infinite running jobs
  • Retry Strategies - Automatic retry with exponential backoff

The following roadmap items can now be marked as completed:

  • Delayed Jobs
  • Allow job cancellation
  • Job Priority
  • Better Job Failures → Option to set timeout on workers
  • Better Job Failures → Add strategies to automatically retry failed jobs

Future Roadmap Suggestions

Based on this implementation, I suggest adding these new roadmap items:

  • Job Metrics and Monitoring
  • Job Dependencies (DAG-based execution)
  • Bulk Operations
  • Job Rate Limiting

Documentation Updates Needed

  • Update README.md with new API examples
  • Add migration guide for new database schema
  • Document worker callback options (max_retries, timeout)

This commit implements five major enhancements to the Que job processing library:

 • Delayed Jobs: Schedule jobs to run at specific times or after delays
    - Add Que.add_scheduled/3 for specific datetime scheduling
    - Add Que.add_in/3 convenience function for delay-based scheduling
    - Jobs with :scheduled status are automatically promoted when ready

  • Job Cancellation: Cancel pending jobs before execution
    - Add Que.cancel/1 to cancel jobs by ID
    - Add Que.cancel_all/1 to cancel all jobs for a worker
    - Only :scheduled and :queued jobs can be cancelled

  • Retry Strategies: Automatic retry with exponential backoff
    - Configurable max_retries per job (defaults to 3)
    - Exponential backoff with jitter to prevent thundering herd
    - Workers can define custom retry limits via callbacks

  • Job Timeouts: Prevent infinite running jobs
    - Configurable timeout per job (defaults to 60 seconds)
    - Jobs exceeding timeout are killed and marked as :timeout
    - Workers can define custom timeouts via callbacks

  • Job Priority: Priority-based job processing
    - Four priority levels: :low, :normal, :high, :urgent
    - Priority queue processing ensures high-priority jobs run first
    - Convenience functions: Que.add_high_priority/2, Que.add_urgent/2

  Breaking Changes: None - all changes are backward compatible

  Database Schema: Updated Mnesia table to include new fields:
  scheduled_at, retry_count, max_retries, last_error, timeout, timeout_ref, priority
@imahmedismail
Copy link
Author

cc: @sheharyarn

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant