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

Test busy actor termination

This commit is contained in:
Mike Perham 2012-02-18 20:01:29 -08:00
parent 92c1942363
commit 0e9b3cede4
5 changed files with 13 additions and 5 deletions

View file

@ -67,7 +67,7 @@ module Sidekiq
@done_callback.call(processor) if @done_callback @done_callback.call(processor) if @done_callback
@busy.delete(processor) @busy.delete(processor)
if stopped? if stopped?
processor.terminate processor.terminate if processor.alive?
else else
@ready << processor @ready << processor
end end

View file

@ -1,7 +1,7 @@
PATH PATH
remote: .. remote: ..
specs: specs:
sidekiq (0.6.0) sidekiq (0.7.0)
celluloid celluloid
connection_pool connection_pool
multi_json multi_json

View file

@ -3,7 +3,7 @@ class WorkController < ApplicationController
@count = rand(100) @count = rand(100)
puts "Adding #{@count} jobs" puts "Adding #{@count} jobs"
@count.times do |x| @count.times do |x|
HardWorker.perform_async('bubba', x) HardWorker.perform_async('bubba', 0.01, x)
end end
end end
@ -12,6 +12,13 @@ class WorkController < ApplicationController
render :nothing => true render :nothing => true
end end
def long
10.times do |x|
HardWorker.perform_async('bob', 10, x)
end
render :text => 'enqueued'
end
def delayed_post def delayed_post
p = Post.first p = Post.first
unless p unless p

View file

@ -1,8 +1,8 @@
class HardWorker class HardWorker
include Sidekiq::Worker include Sidekiq::Worker
def perform(name, count) def perform(name, count, salt)
sleep 1
print "#{Time.now}\n" print "#{Time.now}\n"
sleep count
end end
end end

View file

@ -5,4 +5,5 @@ Myapp::Application.routes.draw do
get "work" => "work#index" get "work" => "work#index"
get "work/email" => "work#email" get "work/email" => "work#email"
get "work/post" => "work#delayed_post" get "work/post" => "work#delayed_post"
get "work/long" => "work#long"
end end