mirror of
https://github.com/mperham/sidekiq.git
synced 2022-11-09 13:52:34 -05:00
Merge branch 'master' into 5-0
This commit is contained in:
commit
bca4f2b224
13 changed files with 23 additions and 21 deletions
|
@ -9,4 +9,5 @@ before_install:
|
|||
rvm:
|
||||
- 2.2.4
|
||||
- 2.3.0
|
||||
- jruby-head
|
||||
- 2.4.0
|
||||
- jruby-9.1.6.0
|
||||
|
|
4
Gemfile
4
Gemfile
|
@ -1,11 +1,11 @@
|
|||
source 'https://rubygems.org'
|
||||
gemspec
|
||||
|
||||
gem 'rails', '5.0.0'
|
||||
gem 'rails', '>= 5.0.1'
|
||||
gem "hiredis"
|
||||
gem 'simplecov'
|
||||
gem 'minitest'
|
||||
gem 'minitest-utils'
|
||||
#gem 'minitest-utils'
|
||||
gem 'toxiproxy'
|
||||
|
||||
platforms :rbx do
|
||||
|
|
|
@ -142,7 +142,7 @@ module Sidekiq
|
|||
end
|
||||
when 'TTIN'
|
||||
Thread.list.each do |thread|
|
||||
Sidekiq.logger.warn "Thread TID-#{thread.object_id.to_s(36)} #{thread['label']}"
|
||||
Sidekiq.logger.warn "Thread TID-#{thread.object_id.to_s(36)} #{thread['sidekiq_label']}"
|
||||
if thread.backtrace
|
||||
Sidekiq.logger.warn thread.backtrace.join("\n")
|
||||
else
|
||||
|
|
|
@ -10,7 +10,7 @@ module Sidekiq
|
|||
|
||||
##
|
||||
# The Manager is the central coordination point in Sidekiq, controlling
|
||||
# the lifecycle of the Processors and feeding them jobs as necessary.
|
||||
# the lifecycle of the Processors.
|
||||
#
|
||||
# Tasks:
|
||||
#
|
||||
|
|
|
@ -162,7 +162,7 @@ module Sidekiq
|
|||
end
|
||||
|
||||
def retry_attempts_from(msg_retry, default)
|
||||
if msg_retry.is_a?(Fixnum)
|
||||
if msg_retry.is_a?(Integer)
|
||||
msg_retry
|
||||
else
|
||||
default
|
||||
|
|
|
@ -22,6 +22,7 @@ module Sidekiq
|
|||
|
||||
def safe_thread(name, &block)
|
||||
Thread.new do
|
||||
Thread.current['sidekiq_label'] = name
|
||||
watchdog(name, &block)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -274,7 +274,7 @@ module Sidekiq
|
|||
resp = case resp
|
||||
when Array
|
||||
resp
|
||||
when Fixnum
|
||||
when Integer
|
||||
[resp, {}, []]
|
||||
else
|
||||
type_header = case action.type
|
||||
|
|
|
@ -20,7 +20,7 @@ Gem::Specification.new do |gem|
|
|||
gem.add_dependency 'concurrent-ruby', '~> 1.0'
|
||||
gem.add_dependency 'rack-protection', '>= 1.5.0'
|
||||
gem.add_development_dependency 'redis-namespace', '~> 1.5', '>= 1.5.2'
|
||||
gem.add_development_dependency 'minitest', '~> 5.7', '>= 5.7.0'
|
||||
gem.add_development_dependency 'minitest', '~> 5.10', '>= 5.10.1'
|
||||
gem.add_development_dependency 'rake', '~> 10.0'
|
||||
gem.add_development_dependency 'rails', '>= 3.2.0'
|
||||
end
|
||||
|
|
|
@ -185,7 +185,7 @@ class TestCli < Sidekiq::Test
|
|||
assert_equal './test/config.yml', Sidekiq.options[:config_file]
|
||||
refute Sidekiq.options[:verbose]
|
||||
assert_equal './test/fake_env.rb', Sidekiq.options[:require]
|
||||
assert_equal nil, Sidekiq.options[:environment]
|
||||
assert_nil Sidekiq.options[:environment]
|
||||
assert_equal 50, Sidekiq.options[:concurrency]
|
||||
assert_equal '/tmp/sidekiq-config-test.pid', Sidekiq.options[:pidfile]
|
||||
assert_equal '/tmp/sidekiq.log', Sidekiq.options[:logfile]
|
||||
|
@ -373,7 +373,7 @@ class TestCli < Sidekiq::Test
|
|||
@tmp_log_path = '/tmp/sidekiq.log'
|
||||
@cli.parse(['sidekiq', '-L', @tmp_log_path, '-r', './test/fake_env.rb'])
|
||||
@mock_thread = MiniTest::Mock.new
|
||||
@mock_thread.expect(:[], 'interrupt_test', ['label'])
|
||||
@mock_thread.expect(:[], 'interrupt_test', ['sidekiq_label'])
|
||||
end
|
||||
|
||||
after do
|
||||
|
|
|
@ -159,7 +159,7 @@ class TestClient < Sidekiq::Test
|
|||
chain.add Stopper
|
||||
end
|
||||
|
||||
assert_equal nil, client.push('class' => MyWorker, 'args' => [0])
|
||||
assert_nil client.push('class' => MyWorker, 'args' => [0])
|
||||
assert_match(/[0-9a-f]{12}/, client.push('class' => MyWorker, 'args' => [1]))
|
||||
client.push_bulk('class' => MyWorker, 'args' => [[0], [1]]).each do |jid|
|
||||
assert_match(/[0-9a-f]{12}/, jid)
|
||||
|
|
|
@ -5,30 +5,30 @@ require 'sidekiq/logging'
|
|||
class TestLogging < Sidekiq::Test
|
||||
describe Sidekiq::Logging do
|
||||
describe "#with_context" do
|
||||
def context
|
||||
def ctx
|
||||
Sidekiq::Logging.logger.formatter.context
|
||||
end
|
||||
|
||||
it "has no context by default" do
|
||||
context.must_equal nil
|
||||
assert_nil ctx
|
||||
end
|
||||
|
||||
it "can add a context" do
|
||||
Sidekiq::Logging.with_context "xx" do
|
||||
context.must_equal " xx"
|
||||
assert_equal " xx", ctx
|
||||
end
|
||||
context.must_equal nil
|
||||
assert_nil ctx
|
||||
end
|
||||
|
||||
it "can use multiple contexts" do
|
||||
Sidekiq::Logging.with_context "xx" do
|
||||
context.must_equal " xx"
|
||||
assert_equal " xx", ctx
|
||||
Sidekiq::Logging.with_context "yy" do
|
||||
context.must_equal " xx yy"
|
||||
assert_equal " xx yy", ctx
|
||||
end
|
||||
context.must_equal " xx"
|
||||
assert_equal " xx", ctx
|
||||
end
|
||||
context.must_equal nil
|
||||
assert_nil ctx
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -112,7 +112,7 @@ class TestMiddleware < Sidekiq::Test
|
|||
|
||||
final_action = nil
|
||||
chain.invoke { final_action = true }
|
||||
assert_equal nil, final_action
|
||||
assert_nil final_action
|
||||
assert_equal [], recorder
|
||||
end
|
||||
end
|
||||
|
|
|
@ -117,7 +117,7 @@ class TestRetryExhausted < Sidekiq::Test
|
|||
|
||||
assert old_worker.exhausted_called?
|
||||
assert_equal raised_error.message, old_worker.exhausted_job['error_message']
|
||||
assert_equal nil, new_worker.exhausted_exception
|
||||
assert_nil new_worker.exhausted_exception
|
||||
end
|
||||
|
||||
it 'allows a global default handler' do
|
||||
|
|
Loading…
Reference in a new issue