Quantcast
Channel: Active questions tagged redis+ruby-on-rails - Stack Overflow
Viewing all articles
Browse latest Browse all 873

unable to access global redis in a Sidekiq job via sidekiq-scheduler

$
0
0

We are thinking of moving from resque-scheduler to sidekiq-scheduler. We have a reference to a global $redis instance but in our job, we are not able to access it, like the following.

require 'sidekiq-scheduler'class HelloWorld  include Sidekiq::Worker  def perform    $redis.incr(Time.new.strftime("hello-world-%Y-%m-%d"))    puts 'Hello world'  endend

Our $redis is instantiated in config/initializers/00_redis.rb like

$redis = Redis.new

which I can access from a rails console. Any idea what I'm doing wrong?


Viewing all articles
Browse latest Browse all 873

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>