ruby-on-railssidekiqsidetiq

Sidekiq worker enqueues but doesn't complete when paired with Sidetiq


I have a Sidekiq worker that syncs the data of a Rails 3.2 application with a remote database. When I just execute it from the rails console, everything works as expected. I can verify that it connects to the remote DB and pulls in the data I am expecting.

The moment I try to set up the following:

recurrence {daily.hour_of_day(20).minute_of_hour(02)}

I see the following in Sidekiq but no signs of completion/execution:

2014-05-14T00:02:18Z 6747 TID-dvc2c INFO: [Sidetiq] Enqueue: BackendWorker (at: 1400112120.0) (last: -1.0)

I've got retries set to false (which I would like to change) currently, and I have attempted to clear out anything in redis before setting up another test run again.

Is there a way to squeeze some more information about what is going on? Is there a Sidekiq flag I can use to get some additional debug information?

Thanks in advance

Environment:

UPDATE (5/14/2014):

I decided to test a simple example with Sidetiq and just have a worker that creates a DB entry with ActiveRecord:

class BackendTest
  include Sidekiq::Worker
  include Sidetiq::Schedulable
  sidekiq_options :retry => false, :backtrace => true

  recurrence {
    daily.hour_of_day(11).minute_of_hour(05)
  }

  def perform
    Book.create(title: "test", author: "testing", price: 9.99)
  end
end

Another experiment I did was just trying to get Sidetiq and Sidekiq to just show something with logger.info:

class BackendTest
  include Sidekiq::Worker
  include Sidetiq::Schedulable
  sidekiq_options :retry => false, :backtrace => true

  recurrence {
    daily.hour_of_day(16).minute_of_hour(00)
  }

  def perform
    logger.info "test"
    logger.info "test"
  end
end

The jobs just still enters the default queue without being started or completed. Everything still works if I just fire it off from the rails console with perform_async, Sidekiq::Client.push, and Sidekiq::Client.enqueue still work from console.

I am a thoroughly confused newbie at this point.

Output:

2014-05-14T20:08:41Z 2149 TID-dfcfk BackendTest JID-6bc7ba08955f8340903f9063 INFO: start 2014-05-14T20:08:41Z 2149 TID-dfcfk BackendTest JID-6bc7ba08955f8340903f9063 INFO: test 2014-05-14T20:08:41Z 2149 TID-dfcfk BackendTest JID-6bc7ba08955f8340903f9063 INFO: test 2014-05-14T20:08:41Z 2149 TID-dfcfk BackendTest JID-6bc7ba08955f8340903f9063 INFO: done: 0.002 sec


Solution

  • After poking around other people's projects on github, I saw something interesting and tried it out and it seemed to solve my problem with Sidetiq.

    I created /config/initializers/sidekiq.rb with the following content inside of it:

    Sidekiq.configure_server do |config|
      config.redis = { :url => 'redis://localhost:6379/3', :namespace => 'sidekiq' }
    end
    
    Sidekiq.configure_client do |config|
      config.redis = { :url => 'redis://localhost:6379/3', :namespace => 'sidekiq' }
    end
    

    Job tasks enqueue and execute as expected.