Sha256: 31487fc28c3379a574dc888e925e449e7acf8d7946410d58c19eac8199f6e46d

Contents?: true

Size: 749 Bytes

Versions: 17

Compression:

Stored size: 749 Bytes

Contents

# Sidekiq defers scheduling to other, better suited gems.
# If you want to run a job regularly, here's an example
# of using the 'whenever' gem to push jobs to Sidekiq
# regularly.

class MyWorker
  include Sidekiq::Worker

  def perform(count)
    puts "Job ##{count}: Late night, so tired..."
  end

  def self.late_night_work
    10.times do |x|
      perform_async(x)
    end
  end
end

# Kick off a bunch of jobs early in the morning
every 1.day, :at => '4:30 am' do
  runner "MyWorker.late_night_work"
end


class HourlyWorker
  include Sidekiq::Worker

  def perform
    cleanup_database
    format_hard_drive
  end
end

every :hour do # Many shortcuts available: :hour, :day, :month, :year, :reboot
  runner "HourlyWorker.perform_async"
end

Version data entries

17 entries across 17 versions & 2 rubygems

Version Path
kulesa-sidekiq-1.2.3 examples/scheduling.rb
kulesa-sidekiq-1.2.2 examples/scheduling.rb
sidekiq-1.2.1 examples/scheduling.rb
sidekiq-1.2.0 examples/scheduling.rb
sidekiq-1.1.4 examples/scheduling.rb
sidekiq-1.1.3 examples/scheduling.rb
sidekiq-1.1.2 examples/scheduling.rb
sidekiq-1.1.1 examples/scheduling.rb
sidekiq-1.1.0 examples/scheduling.rb
sidekiq-1.0.0 examples/scheduling.rb
sidekiq-0.11.2 examples/scheduling.rb
sidekiq-0.11.1 examples/scheduling.rb
sidekiq-0.11.0 examples/scheduling.rb
sidekiq-0.10.1 examples/scheduling.rb
sidekiq-0.10.0 examples/scheduling.rb
sidekiq-0.9.1 examples/scheduling.rb
sidekiq-0.9.0 examples/scheduling.rb