Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 5, 2025

Replaces delayed_job with Sidekiq for background job processing. Sidekiq provides better performance through Redis-backed queuing versus database-backed queuing, and is actively maintained.

Core Changes

  • Dependencies: Replace delayed_job_active_record with sidekiq (> 7.0) and redis (> 5.0)
  • Configuration: Update ActiveJob adapter to :sidekiq, create Sidekiq initializer with Redis connection and queue configuration matching previous delayed_job setup (single retry, 24-hour timeout)
  • Worker Management: Rewrite lib/seek/workers.rb to manage Sidekiq processes while preserving existing rake task interface (seek:workers:start/stop/restart/status)
  • Admin Controller: Update clear_failed_jobs to use Sidekiq API (Sidekiq::DeadSet, Sidekiq::RetrySet) instead of ActiveRecord queries

Infrastructure

  • Docker: Add Redis service to all docker-compose configurations with REDIS_URL environment variable
  • Migration: Drop unused delayed_jobs table (irreversible)
  • Logging: Switch from delayed_job logs to log/sidekiq.log

Backward Compatibility

Rake tasks and admin interface unchanged. Added delayed_job_pids alias in Seek::Util to maintain compatibility with existing code that checks worker status.

Migration Path

Requires Redis running (localhost:6379 or REDIS_URL env var). See MIGRATION_NOTES_SIDEKIQ.md for installation steps and troubleshooting.

# Queue configuration preserved
QueueNames::DEFAULT = 'default'.freeze  # Previously Delayed::Worker.default_queue_name
QueueNames::MAILERS = 'mailers'.freeze  # Unchanged

# Worker management API unchanged
Seek::Workers.start    # Now starts Sidekiq instead of delayed_job
Seek::Workers.stop     # Graceful shutdown with 10s timeout
Original prompt

Migrate the ActiveJob adapter from delayed_job to sidekiq


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 4 commits December 5, 2025 12:48
- Replace delayed_job_active_record with sidekiq and redis gems
- Update ActiveJob queue adapter configuration
- Create sidekiq initializer with Redis and queue configuration
- Replace lib/seek/workers.rb to manage Sidekiq processes
- Update queue_names.rb to remove Delayed::Worker dependency
- Update admin controller to work with Sidekiq workers
- Update Seek::Util helper methods for Sidekiq
- Add Redis service to docker-compose.yml
- Update docker worker startup script to tail sidekiq.log
- Remove delayed_job_config.rb initializer

Co-authored-by: fbacall <[email protected]>
- Update admin controller tests to reference background job workers
- Update clear_failed_jobs to use Sidekiq API instead of ActiveRecord
- Remove obsolete delayed_jobs table check from seek_main.rb
- Add Redis service to docker-compose-virtuoso.yml
- Add Redis service to docker-compose-relative-root.yml

Co-authored-by: fbacall <[email protected]>
- Add Errno::EINVAL to exception handling in process_running?
- Extract PID file reading logic into private method to reduce duplication
- Add comment explaining 24-hour timeout value in sidekiq.yml
- Add comment explaining equal queue weights in sidekiq initializer

Co-authored-by: fbacall <[email protected]>
- Create migration to drop delayed_jobs table
- Add comprehensive migration notes for users upgrading to Sidekiq
- Document Redis requirements and setup steps
- Document troubleshooting and rollback procedures

Co-authored-by: fbacall <[email protected]>
Copilot AI changed the title [WIP] Migrate ActiveJob adapter from delayed_job to sidekiq Migrate ActiveJob adapter from delayed_job to Sidekiq Dec 5, 2025
Copilot AI requested a review from fbacall December 5, 2025 12:58
@fbacall
Copy link
Contributor

fbacall commented Dec 5, 2025

Issues:
in config/initializers/sidekiq.rb, this seems to be a hallucinated option:

Sidekiq.options[:queues] = [
  ['default', 2],
  ['mailers', 2],
  ['authlookup', 2],
  ['remotecontent', 2],
  ['samples', 2],
  ['indexing', 2],
  ['templates', 2],
  ['datafiles', 2]
]

The default concurrency of 5 makes jobs extremely slow (when testing locally), possibly due to waiting for access to the database?

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.

2 participants