mirror of
https://github.com/mperham/sidekiq.git
synced 2022-11-09 13:52:34 -05:00
merge 2.17.5 stuff
This commit is contained in:
commit
7d2b387d94
15 changed files with 28 additions and 25 deletions
|
@ -23,6 +23,7 @@ Please see [Upgrading.md](Upgrading.md) for upgrade notes.
|
||||||
2.17.5
|
2.17.5
|
||||||
-----------
|
-----------
|
||||||
|
|
||||||
|
- Automatically use the config file found at `config/sidekiq.yml`, if not passed `-C`. [#1481]
|
||||||
- Store 'retried\_at' and 'failed\_at' timestamps as Floats, not Strings. [#1473]
|
- Store 'retried\_at' and 'failed\_at' timestamps as Floats, not Strings. [#1473]
|
||||||
- A `USR2` signal will now reopen _all_ logs, using IO#reopen. Thus, instead of creating a new Logger object,
|
- A `USR2` signal will now reopen _all_ logs, using IO#reopen. Thus, instead of creating a new Logger object,
|
||||||
Sidekiq will now just update the existing Logger's file descriptor [#1163].
|
Sidekiq will now just update the existing Logger's file descriptor [#1163].
|
||||||
|
|
|
@ -3,10 +3,11 @@ Sidekiq Pro Changelog
|
||||||
|
|
||||||
Please see [http://sidekiq.org/pro](http://sidekiq.org/pro) for more details and how to buy.
|
Please see [http://sidekiq.org/pro](http://sidekiq.org/pro) for more details and how to buy.
|
||||||
|
|
||||||
HEAD
|
1.4.3
|
||||||
-----------
|
-----------
|
||||||
|
|
||||||
- Reverse sorting of Batches in Web UI [#1098]
|
- Reverse sorting of Batches in Web UI [#1098]
|
||||||
|
- Refactoring for Sidekiq 3.0, Pro now requires Sidekiq 2.17.5
|
||||||
|
|
||||||
1.4.2
|
1.4.2
|
||||||
-----------
|
-----------
|
||||||
|
|
|
@ -28,10 +28,10 @@ module Sidekiq
|
||||||
|
|
||||||
def self.included(klass)
|
def self.included(klass)
|
||||||
if $TESTING
|
if $TESTING
|
||||||
klass.send(:include, InstanceMethods)
|
klass.__send__(:include, InstanceMethods)
|
||||||
klass.send(:extend, ClassMethods)
|
klass.__send__(:extend, ClassMethods)
|
||||||
else
|
else
|
||||||
klass.send(:include, Celluloid)
|
klass.__send__(:include, Celluloid)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -207,7 +207,7 @@ module Sidekiq
|
||||||
end
|
end
|
||||||
|
|
||||||
def [](name)
|
def [](name)
|
||||||
@item.send(:[], name)
|
@item.__send__(:[], name)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ Capistrano::Configuration.instance.load do
|
||||||
task :start, :roles => lambda { fetch(:sidekiq_role) }, :on_no_matching_servers => :continue do
|
task :start, :roles => lambda { fetch(:sidekiq_role) }, :on_no_matching_servers => :continue do
|
||||||
rails_env = fetch(:rails_env, "production")
|
rails_env = fetch(:rails_env, "production")
|
||||||
for_each_process do |pid_file, idx|
|
for_each_process do |pid_file, idx|
|
||||||
run "cd #{current_path} ; nohup #{fetch(:sidekiq_cmd)} -e #{rails_env} -C #{current_path}/config/sidekiq.yml -i #{idx} -P #{pid_file} >> #{current_path}/log/sidekiq.log 2>&1 &", :pty => false
|
run "cd #{current_path} ; nohup #{fetch(:sidekiq_cmd)} -e #{rails_env} -i #{idx} -P #{pid_file} >> #{current_path}/log/sidekiq.log 2>&1 &", :pty => false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -299,6 +299,7 @@ module Sidekiq
|
||||||
die 1
|
die 1
|
||||||
end
|
end
|
||||||
@parser.parse!(argv)
|
@parser.parse!(argv)
|
||||||
|
opts[:config_file] ||= 'config/sidekiq.yml' if File.exist?('config/sidekiq.yml')
|
||||||
opts
|
opts
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ module Sidekiq
|
||||||
|
|
||||||
def perform(yml)
|
def perform(yml)
|
||||||
(target, method_name, args) = YAML.load(yml)
|
(target, method_name, args) = YAML.load(yml)
|
||||||
msg = target.send(method_name, *args)
|
msg = target.__send__(method_name, *args)
|
||||||
# The email method can return nil, which causes ActionMailer to return
|
# The email method can return nil, which causes ActionMailer to return
|
||||||
# an undeliverable empty message.
|
# an undeliverable empty message.
|
||||||
msg.deliver if msg && (msg.to || msg.cc || msg.bcc) && msg.from
|
msg.deliver if msg && (msg.to || msg.cc || msg.bcc) && msg.from
|
||||||
|
|
|
@ -16,7 +16,7 @@ module Sidekiq
|
||||||
|
|
||||||
def perform(yml)
|
def perform(yml)
|
||||||
(target, method_name, args) = YAML.load(yml)
|
(target, method_name, args) = YAML.load(yml)
|
||||||
target.send(method_name, *args)
|
target.__send__(method_name, *args)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ module Sidekiq
|
||||||
|
|
||||||
def perform(yml)
|
def perform(yml)
|
||||||
(target, method_name, args) = YAML.load(yml)
|
(target, method_name, args) = YAML.load(yml)
|
||||||
target.send(method_name, *args)
|
target.__send__(method_name, *args)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -36,4 +36,4 @@ module Sidekiq
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
Module.send(:include, Sidekiq::Extensions::Klass)
|
Module.__send__(:include, Sidekiq::Extensions::Klass)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
module Sidekiq
|
module Sidekiq
|
||||||
def self.hook_rails!
|
def self.hook_rails!
|
||||||
if defined?(::ActiveRecord)
|
if defined?(::ActiveRecord)
|
||||||
::ActiveRecord::Base.send(:include, Sidekiq::Extensions::ActiveRecord)
|
::ActiveRecord::Base.__send__(:include, Sidekiq::Extensions::ActiveRecord)
|
||||||
end
|
end
|
||||||
|
|
||||||
if defined?(::ActionMailer)
|
if defined?(::ActionMailer)
|
||||||
|
|
|
@ -15,7 +15,7 @@ namespace :load do
|
||||||
set :sidekiq_pid, ->{ "tmp/sidekiq.pid" }
|
set :sidekiq_pid, ->{ "tmp/sidekiq.pid" }
|
||||||
|
|
||||||
# "-d -i INT -P PATH" are added automatically.
|
# "-d -i INT -P PATH" are added automatically.
|
||||||
set :sidekiq_options, ->{ "-e #{fetch(:rails_env, 'production')} -C #{current_path}/config/sidekiq.yml -L #{current_path}/log/sidekiq.log" }
|
set :sidekiq_options, ->{ "-e #{fetch(:rails_env, 'production')} -L #{current_path}/log/sidekiq.log" }
|
||||||
|
|
||||||
set :sidekiq_timeout, ->{ 10 }
|
set :sidekiq_timeout, ->{ 10 }
|
||||||
set :sidekiq_role, ->{ :app }
|
set :sidekiq_role, ->{ :app }
|
||||||
|
|
|
@ -294,8 +294,8 @@ class TestCli < Sidekiq::Test
|
||||||
describe 'when weight is present' do
|
describe 'when weight is present' do
|
||||||
it 'concatenates queues by factor of weight and sets strict to false' do
|
it 'concatenates queues by factor of weight and sets strict to false' do
|
||||||
opts = { strict: true }
|
opts = { strict: true }
|
||||||
@cli.send :parse_queues, opts, [['often', 7], ['repeatedly', 3]]
|
@cli.__send__ :parse_queues, opts, [['often', 7], ['repeatedly', 3]]
|
||||||
@cli.send :parse_queues, opts, [['once']]
|
@cli.__send__ :parse_queues, opts, [['once']]
|
||||||
assert_equal (%w[often] * 7 + %w[repeatedly] * 3 + %w[once]), opts[:queues]
|
assert_equal (%w[often] * 7 + %w[repeatedly] * 3 + %w[once]), opts[:queues]
|
||||||
assert !opts[:strict]
|
assert !opts[:strict]
|
||||||
end
|
end
|
||||||
|
@ -304,8 +304,8 @@ class TestCli < Sidekiq::Test
|
||||||
describe 'when weight is not present' do
|
describe 'when weight is not present' do
|
||||||
it 'returns queues and sets strict' do
|
it 'returns queues and sets strict' do
|
||||||
opts = { strict: true }
|
opts = { strict: true }
|
||||||
@cli.send :parse_queues, opts, [['once'], ['one_time']]
|
@cli.__send__ :parse_queues, opts, [['once'], ['one_time']]
|
||||||
@cli.send :parse_queues, opts, [['einmal']]
|
@cli.__send__ :parse_queues, opts, [['einmal']]
|
||||||
assert_equal %w[once one_time einmal], opts[:queues]
|
assert_equal %w[once one_time einmal], opts[:queues]
|
||||||
assert opts[:strict]
|
assert opts[:strict]
|
||||||
end
|
end
|
||||||
|
@ -316,7 +316,7 @@ class TestCli < Sidekiq::Test
|
||||||
describe 'when weight is present' do
|
describe 'when weight is present' do
|
||||||
it 'concatenates queue to opts[:queues] weight number of times and sets strict to false' do
|
it 'concatenates queue to opts[:queues] weight number of times and sets strict to false' do
|
||||||
opts = { strict: true }
|
opts = { strict: true }
|
||||||
@cli.send :parse_queue, opts, 'often', 7
|
@cli.__send__ :parse_queue, opts, 'often', 7
|
||||||
assert_equal %w[often] * 7, opts[:queues]
|
assert_equal %w[often] * 7, opts[:queues]
|
||||||
assert !opts[:strict]
|
assert !opts[:strict]
|
||||||
end
|
end
|
||||||
|
@ -325,7 +325,7 @@ class TestCli < Sidekiq::Test
|
||||||
describe 'when weight is not present' do
|
describe 'when weight is not present' do
|
||||||
it 'concatenates queue to opts[:queues] once and leaves strict true' do
|
it 'concatenates queue to opts[:queues] once and leaves strict true' do
|
||||||
opts = { strict: true }
|
opts = { strict: true }
|
||||||
@cli.send :parse_queue, opts, 'once', nil
|
@cli.__send__ :parse_queue, opts, 'once', nil
|
||||||
assert_equal %w[once], opts[:queues]
|
assert_equal %w[once], opts[:queues]
|
||||||
assert opts[:strict]
|
assert opts[:strict]
|
||||||
end
|
end
|
||||||
|
|
|
@ -226,11 +226,11 @@ class TestClient < Sidekiq::Test
|
||||||
|
|
||||||
describe 'item normalization' do
|
describe 'item normalization' do
|
||||||
it 'defaults retry to true' do
|
it 'defaults retry to true' do
|
||||||
assert_equal true, Sidekiq::Client.new.send(:normalize_item, 'class' => QueuedWorker, 'args' => [])['retry']
|
assert_equal true, Sidekiq::Client.new.__send__(:normalize_item, 'class' => QueuedWorker, 'args' => [])['retry']
|
||||||
end
|
end
|
||||||
|
|
||||||
it "does not normalize numeric retry's" do
|
it "does not normalize numeric retry's" do
|
||||||
assert_equal 2, Sidekiq::Client.new.send(:normalize_item, 'class' => CWorker, 'args' => [])['retry']
|
assert_equal 2, Sidekiq::Client.new.__send__(:normalize_item, 'class' => CWorker, 'args' => [])['retry']
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -77,7 +77,7 @@ class TestRedisConnection < Sidekiq::Test
|
||||||
ENV[v] = nil
|
ENV[v] = nil
|
||||||
end
|
end
|
||||||
ENV[var] = uri
|
ENV[var] = uri
|
||||||
assert_equal uri, Sidekiq::RedisConnection.send(:determine_redis_provider)
|
assert_equal uri, Sidekiq::RedisConnection.__send__(:determine_redis_provider)
|
||||||
ENV[var] = nil
|
ENV[var] = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -208,7 +208,7 @@ class TestRetry < Sidekiq::Test
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'calls worker sidekiq_retries_exhausted_block after too many retries' do
|
it 'calls worker sidekiq_retries_exhausted_block after too many retries' do
|
||||||
new_msg = handler.send(:retries_exhausted, worker.new, msg)
|
new_msg = handler.__send__(:retries_exhausted, worker.new, msg)
|
||||||
expected_msg = msg.merge('called_by_callback' => true)
|
expected_msg = msg.merge('called_by_callback' => true)
|
||||||
|
|
||||||
assert_equal expected_msg, new_msg, "sidekiq_retries_exhausted block not called"
|
assert_equal expected_msg, new_msg, "sidekiq_retries_exhausted block not called"
|
||||||
|
@ -270,15 +270,15 @@ class TestRetry < Sidekiq::Test
|
||||||
let(:handler) { Sidekiq::Middleware::Server::RetryJobs.new }
|
let(:handler) { Sidekiq::Middleware::Server::RetryJobs.new }
|
||||||
|
|
||||||
it "retries with a default delay" do
|
it "retries with a default delay" do
|
||||||
refute_equal 4, handler.send(:delay_for, worker, 2)
|
refute_equal 4, handler.__send__(:delay_for, worker, 2)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "retries with a custom delay" do
|
it "retries with a custom delay" do
|
||||||
assert_equal 4, handler.send(:delay_for, custom_worker, 2)
|
assert_equal 4, handler.__send__(:delay_for, custom_worker, 2)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "falls back to the default retry on exception" do
|
it "falls back to the default retry on exception" do
|
||||||
refute_equal 4, handler.send(:delay_for, error_worker, 2)
|
refute_equal 4, handler.__send__(:delay_for, error_worker, 2)
|
||||||
assert_match(/Failure scheduling retry using the defined `sidekiq_retry_in`/,
|
assert_match(/Failure scheduling retry using the defined `sidekiq_retry_in`/,
|
||||||
File.read(@tmp_log_path), 'Log entry missing for sidekiq_retry_in')
|
File.read(@tmp_log_path), 'Log entry missing for sidekiq_retry_in')
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue