1
0
Fork 0
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:
Mike Perham 2017-03-24 11:19:44 -07:00
commit 773dd89c18
5 changed files with 10 additions and 3 deletions

View file

@ -6,6 +6,7 @@ Please see [http://sidekiq.org/](http://sidekiq.org/) for more details and how t
HEAD
---------
- Re-implement `Sidekiq::Queue#delete_job` to avoid O(n) runtime [#3408]
- Batch page displays Pending JIDs if less than 10 [#3130]
- Batch page has a Search button to find associated Retries [#3130]
- Make Batch UI progress bar more friendly to the colorblind [#3387]

View file

@ -48,6 +48,7 @@ module Sidekiq
# queue - the named queue to use, default 'default'
# class - the worker class to call, required
# args - an array of simple arguments to the perform method, must be JSON-serializable
# at - timestamp to schedule the job (optional), must be Numeric (e.g. Time.now.to_f)
# retry - whether to retry this job if it fails, default true or an integer number of retries
# backtrace - whether to save any error backtrace, default false
#
@ -212,6 +213,7 @@ module Sidekiq
raise(ArgumentError, "Job must be a Hash with 'class' and 'args' keys: { 'class' => SomeWorker, 'args' => ['bob', 1, :foo => 'bar'] }") unless item.is_a?(Hash) && item.has_key?('class'.freeze) && item.has_key?('args'.freeze)
raise(ArgumentError, "Job args must be an Array") unless item['args'].is_a?(Array)
raise(ArgumentError, "Job class must be either a Class or String representation of the class name") unless item['class'.freeze].is_a?(Class) || item['class'.freeze].is_a?(String)
raise(ArgumentError, "Job 'at' must be a Numeric timestamp") if item.has_key?('at'.freeze) && !item['at'].is_a?(Numeric)
#raise(ArgumentError, "Arguments must be native JSON types, see https://github.com/mperham/sidekiq/wiki/Best-Practices") unless JSON.load(JSON.dump(item['args'])) == item['args']
normalized_hash(item['class'.freeze])

View file

@ -59,10 +59,10 @@ Sidekiq::Test = Minitest::Test
require 'sidekiq/redis_connection'
REDIS_URL = ENV['REDIS_URL'] || 'redis://localhost/15'
REDIS = Sidekiq::RedisConnection.create(:url => REDIS_URL, :namespace => 'testy')
REDIS = Sidekiq::RedisConnection.create(:url => REDIS_URL)
Sidekiq.configure_client do |config|
config.redis = { :url => REDIS_URL, :namespace => 'testy' }
config.redis = { :url => REDIS_URL }
end
def capture_logging(lvl=Logger::INFO)

View file

@ -23,6 +23,10 @@ class TestClient < Sidekiq::Test
assert_raises ArgumentError do
Sidekiq::Client.push('queue' => 'foo', 'class' => MyWorker, 'args' => 1)
end
assert_raises ArgumentError do
Sidekiq::Client.push('queue' => 'foo', 'class' => MyWorker, 'args' => [1], 'at' => Time.now)
end
end
end

View file

@ -5,7 +5,7 @@ require 'sidekiq/fetch'
class TestFetcher < Sidekiq::Test
describe 'fetcher' do
before do
Sidekiq.redis = { :url => REDIS_URL, :namespace => 'fuzzy' }
Sidekiq.redis = { :url => REDIS_URL }
Sidekiq.redis do |conn|
conn.flushdb
conn.rpush('queue:basic', 'msg')