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:
parent
92c1942363
commit
0e9b3cede4
5 changed files with 13 additions and 5 deletions
|
@ -67,7 +67,7 @@ module Sidekiq
|
|||
@done_callback.call(processor) if @done_callback
|
||||
@busy.delete(processor)
|
||||
if stopped?
|
||||
processor.terminate
|
||||
processor.terminate if processor.alive?
|
||||
else
|
||||
@ready << processor
|
||||
end
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
PATH
|
||||
remote: ..
|
||||
specs:
|
||||
sidekiq (0.6.0)
|
||||
sidekiq (0.7.0)
|
||||
celluloid
|
||||
connection_pool
|
||||
multi_json
|
||||
|
|
|
@ -3,7 +3,7 @@ class WorkController < ApplicationController
|
|||
@count = rand(100)
|
||||
puts "Adding #{@count} jobs"
|
||||
@count.times do |x|
|
||||
HardWorker.perform_async('bubba', x)
|
||||
HardWorker.perform_async('bubba', 0.01, x)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -12,6 +12,13 @@ class WorkController < ApplicationController
|
|||
render :nothing => true
|
||||
end
|
||||
|
||||
def long
|
||||
10.times do |x|
|
||||
HardWorker.perform_async('bob', 10, x)
|
||||
end
|
||||
render :text => 'enqueued'
|
||||
end
|
||||
|
||||
def delayed_post
|
||||
p = Post.first
|
||||
unless p
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
class HardWorker
|
||||
include Sidekiq::Worker
|
||||
|
||||
def perform(name, count)
|
||||
sleep 1
|
||||
def perform(name, count, salt)
|
||||
print "#{Time.now}\n"
|
||||
sleep count
|
||||
end
|
||||
end
|
||||
|
|
|
@ -5,4 +5,5 @@ Myapp::Application.routes.draw do
|
|||
get "work" => "work#index"
|
||||
get "work/email" => "work#email"
|
||||
get "work/post" => "work#delayed_post"
|
||||
get "work/long" => "work#long"
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue