forked from sidekiq/sidekiq
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpor.rb
27 lines (23 loc) · 755 Bytes
/
por.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
require 'sidekiq'
# If your client is single-threaded, we just need a single connection in our Redis connection pool
Sidekiq.configure_client do |config|
config.redis = { :namespace => 'x', :size => 1 }
end
# Sidekiq server is multi-threaded so our Redis connection pool size defaults to concurrency (-c)
Sidekiq.configure_server do |config|
config.redis = { :namespace => 'x' }
end
# 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