Skip to content

Instantly share code, notes, and snippets.

@andruby
Created June 30, 2016 09:01
Show Gist options
  • Save andruby/dc607d005d2ff760ebd38c8be285aa21 to your computer and use it in GitHub Desktop.
Save andruby/dc607d005d2ff760ebd38c8be285aa21 to your computer and use it in GitHub Desktop.
Sidekiq pusher
job_type :sidekiq, 'cd :path && bundle exec script/sidekiq_pusher.rb :worker :task'
every 1.hour do
sidekiq "job_name", worker: 'WorkerName'
end
#! /usr/bin/env ruby
# USAGE: ./sidekiq_pusher.rb WorkerName job
klass = ARGV[0]
task = ARGV[1]
require 'sidekiq'
# See config/initializers/sidekiq.rb
Sidekiq.configure_client do |config|
# Set namespace if needed
# config.redis = { namespace: "#{env_identifier}:sidekiq" }
end
Sidekiq::Client.push('class' => klass, 'args' => [task])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment