1
0
Fork 0
mirror of https://github.com/mperham/sidekiq.git synced 2022-11-09 13:52:34 -05:00
mperham--sidekiq/examples/por.rb

28 lines
755 B
Ruby
Raw Normal View History

2012-02-13 00:35:14 -05:00
require 'sidekiq'
2012-02-21 19:09:01 -05:00
# If your client is single-threaded, we just need a single connection in our Redis connection pool
Sidekiq.configure_client do |config|
2014-03-09 17:59:55 -04:00
config.redis = { :namespace => 'x', :size => 1 }
2012-02-21 19:09:01 -05:00
end
# Sidekiq server is multi-threaded so our Redis connection pool size defaults to concurrency (-c)
Sidekiq.configure_server do |config|
2014-03-09 17:59:55 -04:00
config.redis = { :namespace => 'x' }
2012-02-21 19:09:01 -05:00
end
2012-02-13 00:35:14 -05:00
# Start up sidekiq via
# ./bin/sidekiq -r ./examples/por.rb
# and then you can open up an IRB session like so:
# irb -r ./examples/por.rb
# where you can then say
# PlainOldRuby.perform_async "like a dog", 3
#
class PlainOldRuby
include Sidekiq::Worker
def perform(how_hard="super hard", how_long=1)
sleep how_long
puts "Workin' #{how_hard}"
end
end