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

1st crack at timeouts

This commit is contained in:
Stephen Vanterpool 2012-04-26 06:57:39 -07:00
parent f8e92f282c
commit 34543f10d9

View file

@ -0,0 +1,20 @@
require 'timeout'
module Sidekiq
module Middleware
module Server
class Timeout
@timeout_in_seconds
def initialize(options={:timeout => 120})
@timeout_in_seconds = options[:timeout]
end
def call(worker, msg, queue)
Timeout::timeout (@timeout_in_seconds) {
yield
}
end
end
end
end
end