So I have a Rails app with the following configuration:
# config/sideqik.yml
---
:verbose: true
:concurrency: 5
:pidfile: tmp/pids/sidekiq.pid
:staging:
:concurrency: 10
:production:
:concurrency: 20
:queues:
- default
- mailers
# config/initializers/sidekiq.rb
require 'sidekiq/web'
Sidekiq.configure_server do |config|
config.redis = { url: ENV.fetch('SIDEKIQ_REDIS_URL', 'redis://localhost:6379/12') }
end
Sidekiq.configure_client do |config|
config.redis = { url: ENV.fetch('SIDEKIQ_REDIS_URL', 'redis://localhost:6379/12') }
end
And I have the following worker:
# app/workers/hard_worker.rb
class HardWorker
include Sidekiq::Worker
sidekiq_options queue: 'default', backtrace: 5
def perform(name, count, salt)
raise name if name == 'crash'
sleep count
end
end
In one console tab, I run bin/sidekiq. In another tab, I run bin/rails c.
$ bin/rails c
Running via Spring preloader in process 18864
Loading development environment (Rails 4.2.6)
irb: warn: can't alias context from irb_context.
irb(main):001:0> HardWorker.perform_async 'foo', 1, SecureRandom.uuid
=> "b2c69a787c25740a6d7b4885"
irb(main):002:0> ENV["SIDEKIQ_REDIS_URL"]
=> "redis://localhost:6379/7"
Now, when I look at the logs for sidekiq, I see nothing beyond the startup:
$ bin/sidekiq
2016-07-01T22:05:17.986Z 18262 TID-owbqr7xsc INFO: Booting Sidekiq 4.1.1 with redis options {:url=>"redis://localhost:6379/7"}
m,
`$b
.ss, $$: .,d$
`$$P,d$P' .,md$P"'
,$$$$$bmmd$$$P^'
.d$$$$$$$$$$P'
$$^' `"^$$$' ____ _ _ _ _
$: ,$$: / ___|(_) __| | ___| | _(_) __ _
`b :$$ \___ \| |/ _` |/ _ \ |/ / |/ _` |
$$: ___) | | (_| | __/ <| | (_| |
$$ |____/|_|\__,_|\___|_|\_\_|\__, |
.d$$ |_|
2016-07-01T22:05:18.802Z 18262 TID-owbqr7xsc INFO: Running in ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin14]
2016-07-01T22:05:18.802Z 18262 TID-owbqr7xsc INFO: See LICENSE and the LGPL-3.0 for licensing details.
2016-07-01T22:05:18.802Z 18262 TID-owbqr7xsc INFO: Upgrade to Sidekiq Pro for more features and support: http://sidekiq.org 2016-07-01T22:05:18.806Z 18262 TID-owbqr7xsc DEBUG: Client Middleware:
2016-07-01T22:05:18.821Z 18262 TID-owbqr7xsc DEBUG: Server Middleware: Sidekiq::Middleware::Server::Logging, Sidekiq::Middleware::Server::RetryJobs, Sidekiq::Middleware::Server::ActiveRecord
2016-07-01T22:05:18.821Z 18262 TID-owbqr7xsc INFO: Starting processing, hit Ctrl-C to stop
2016-07-01T22:05:18.868Z 18262 TID-owbqr7xsc DEBUG: {:queues=>["default", "mailers"], :labels=>[], :concurrency=>5, :require=>".", :environment=>nil, :timeout=>8, :poll_interval_average=>nil, :average_scheduled_poll_interval=>15, :error_handlers=>[#<Sidekiq::ExceptionHandler::Logger:0x007fc3fb27d938>, #<Proc:0x007fc3fb70f578@/usr/local/opt/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/exception_notification-4.1.4/lib/exception_notification/sidekiq.rb:27>], :lifecycle_events=>{:startup=>[], :quiet=>[], :shutdown=>[]}, :dead_max_jobs=>10000, :dead_timeout_in_seconds=>15552000, :verbose=>true, :pidfile=>"tmp/pids/sidekiq.pid", :staging=>{:concurrency=>10}, :production=>{:concurrency=>20}, :config_file=>"config/sidekiq.yml", :strict=>true, :tag=>"fenix"}
So, it seems that the job is never making it into the queue to be processed.
What am I doing wrong?