sidekiq 4.1.1 → 4.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +3 -0
  3. data/COMM-LICENSE +1 -1
  4. data/Changes.md +7 -0
  5. data/Ent-Changes.md +6 -0
  6. data/Gemfile +1 -0
  7. data/Pro-3.0-Upgrade.md +5 -7
  8. data/Pro-Changes.md +35 -0
  9. data/README.md +2 -1
  10. data/bin/sidekiqload +2 -2
  11. data/lib/sidekiq.rb +1 -0
  12. data/lib/sidekiq/api.rb +3 -1
  13. data/lib/sidekiq/cli.rb +1 -0
  14. data/lib/sidekiq/client.rb +10 -3
  15. data/lib/sidekiq/core_ext.rb +1 -0
  16. data/lib/sidekiq/exception_handler.rb +2 -1
  17. data/lib/sidekiq/extensions/action_mailer.rb +1 -0
  18. data/lib/sidekiq/extensions/active_record.rb +1 -0
  19. data/lib/sidekiq/extensions/class_methods.rb +1 -0
  20. data/lib/sidekiq/extensions/generic_proxy.rb +1 -0
  21. data/lib/sidekiq/fetch.rb +1 -0
  22. data/lib/sidekiq/launcher.rb +2 -0
  23. data/lib/sidekiq/logging.rb +2 -1
  24. data/lib/sidekiq/manager.rb +1 -0
  25. data/lib/sidekiq/middleware/chain.rb +1 -0
  26. data/lib/sidekiq/middleware/i18n.rb +1 -0
  27. data/lib/sidekiq/middleware/server/retry_jobs.rb +7 -7
  28. data/lib/sidekiq/paginator.rb +1 -0
  29. data/lib/sidekiq/processor.rb +1 -0
  30. data/lib/sidekiq/rails.rb +1 -0
  31. data/lib/sidekiq/redis_connection.rb +1 -0
  32. data/lib/sidekiq/scheduled.rb +1 -0
  33. data/lib/sidekiq/testing.rb +1 -0
  34. data/lib/sidekiq/testing/inline.rb +1 -0
  35. data/lib/sidekiq/util.rb +1 -0
  36. data/lib/sidekiq/version.rb +2 -1
  37. data/lib/sidekiq/web.rb +1 -0
  38. data/lib/sidekiq/web_helpers.rb +2 -1
  39. data/lib/sidekiq/worker.rb +1 -0
  40. data/test/fake_env.rb +1 -0
  41. data/test/helper.rb +1 -0
  42. data/test/test_actors.rb +1 -0
  43. data/test/test_api.rb +1 -0
  44. data/test/test_cli.rb +1 -0
  45. data/test/test_client.rb +30 -0
  46. data/test/test_exception_handler.rb +2 -1
  47. data/test/test_extensions.rb +1 -0
  48. data/test/test_fetch.rb +1 -0
  49. data/test/test_launcher.rb +5 -0
  50. data/test/test_logging.rb +1 -0
  51. data/test/test_manager.rb +1 -0
  52. data/test/test_middleware.rb +1 -0
  53. data/test/test_processor.rb +1 -0
  54. data/test/test_rails.rb +1 -0
  55. data/test/test_redis_connection.rb +1 -0
  56. data/test/test_retry.rb +1 -0
  57. data/test/test_scheduled.rb +1 -0
  58. data/test/test_scheduling.rb +1 -0
  59. data/test/test_sidekiq.rb +1 -0
  60. data/test/test_testing.rb +1 -0
  61. data/test/test_testing_fake.rb +1 -0
  62. data/test/test_testing_inline.rb +2 -1
  63. data/test/test_util.rb +1 -0
  64. data/test/test_web.rb +1 -0
  65. data/test/test_web_helpers.rb +1 -0
  66. data/web/locales/en.yml +1 -0
  67. data/web/locales/ru.yml +3 -0
  68. data/web/views/_nav.erb +1 -1
  69. data/web/views/busy.erb +2 -2
  70. metadata +3 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f3831fb91606790c4912c4fb8d96a560e49aa9b5
4
- data.tar.gz: 74e50d973aab4a58f00f7176ea640dd52f37e218
3
+ metadata.gz: a763f8ad28c68c25f87a3cd858b5aa7aafc692e7
4
+ data.tar.gz: ac87d118a8035ddce4515af0a73a67bb84ea684b
5
5
  SHA512:
6
- metadata.gz: b5b098a51e90fff82508ddfa1b565d1e06758e99de904870795919314987439231aeeb1b315212eed9dcc771a9464909fa437e6990b799e8c245c52506b66eee
7
- data.tar.gz: e1a1ae8f6c3217333b69187041ac8e1c974ebc29aa862b9abab284ae312d8680d960191defb1e67d7a3e6ee95c9d9a924cfc308f5e96e06a38157e0e0dd45ebe
6
+ metadata.gz: bd5f4c504c85438366e296c17bb33faaa2b3e78dc484989fdb3b503f25de07e97fee9566154dbd8a6fa33373ce2d3536dc027f33e77527c42c39768dc3befebe
7
+ data.tar.gz: 47875b3a13a707f9fd7267ae8030353c425d46f2b4da82ec954cdc54020c2b3bd8e774bc463b63b8022149bd6249b17fe3dd217d85f3f51416ff71757fe9a3df
@@ -3,6 +3,9 @@ sudo: false
3
3
  cache: bundler
4
4
  services:
5
5
  - redis-server
6
+ before_install:
7
+ - gem install bundler
8
+ - gem update bundler
6
9
  rvm:
7
10
  - 2.0.0
8
11
  - 2.1.8
@@ -28,7 +28,7 @@ In order to use the Software under this Agreement, you must receive a “Source
28
28
 
29
29
  3.1 You shall not (and shall not allow any third party to): (a) decompile, disassemble, or otherwise reverse engineer the Software or attempt to reconstruct or discover any source code, underlying ideas, algorithms, file formats or programming interfaces of the Software by any means whatsoever (except and only to the extent that applicable law prohibits or restricts reverse engineering restrictions); (b) distribute, sell, sublicense, rent, lease or use the Software for time sharing, hosting, service provider or like purposes, except as expressly permitted under this Agreement; (c) redistribute the Software or Modifications other than by including the Software or a portion thereof within your own product, which must have substantially different functionality than the Software or Modifications and must not allow any third party to use the Software or Modifications, or any portions thereof, for software development or application development purposes; (d) redistribute the Software as part of a product, "appliance" or "virtual server"; (e) redistribute the Software on any server which is not directly under your control; (f) remove any product identification, proprietary, copyright or other notices contained in the Software; (g) modify any part of the Software, create a derivative work of any part of the Software (except as permitted in Section 4), or incorporate the Software, except to the extent expressly authorized in writing by Contributed Systems; (h) publicly disseminate performance information or analysis (including, without limitation, benchmarks) from any source relating to the Software; (i) utilize any equipment, device, software, or other means designed to circumvent or remove any form of Source URL or copy protection used by Contributed Systems in connection with the Software, or use the Software together with any authorization code, Source URL, serial number, or other copy protection device not supplied by Contributed Systems; (j) use the Software to develop a product which is competitive with any Contributed Systems product offerings; or (k) use unauthorized Source URLS or keycode(s) or distribute or publish Source URLs or keycode(s), except as may be expressly permitted by Contributed Systems in writing. If your unique Source URL is ever published, Contributed Systems reserves the right to terminate your access without notice.
30
30
 
31
- 3.2 UNDER NO CIRCUMSTANCES MAY YOU USE THE SOFTWARE FOR A PRODUCT THAT IS INTENDED FOR SOFTWARE OR APPLICATION DEVELOPMENT PURPOSES.
31
+ 3.2 UNDER NO CIRCUMSTANCES MAY YOU USE THE SOFTWARE AS PART OF A PRODUCT OR SERVICE THAT PROVIDES SIMILAR FUNCTIONALITY TO THE SOFTWARE ITSELF.
32
32
 
33
33
  The Open Source version of the Software (“LGPL Version”) is licensed
34
34
  under the terms of the GNU Lesser General Public License versions 3.0
data/Changes.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Sidekiq Changes
2
2
 
3
+ 4.1.2
4
+ -----------
5
+
6
+ - **IMPORTANT** Fix memory leak with worker data in Redis.
7
+ - Freeze all string literals with Ruby 2.3. [#2741]
8
+ - Client middleware can now stop bulk job push. [#2887]
9
+
3
10
  4.1.1
4
11
  -----------
5
12
 
@@ -3,6 +3,12 @@ Sidekiq Enterprise Changelog
3
3
 
4
4
  Please see [http://sidekiq.org/](http://sidekiq.org/) for more details and how to buy.
5
5
 
6
+ HEAD
7
+ -------------
8
+
9
+ - Add API to check if a unique lock is present. See [#2932] for details.
10
+ - Tune concurrent limiters to minimize thread thrashing under heavy contention. [#2944]
11
+
6
12
  1.2.1
7
13
  -------------
8
14
 
data/Gemfile CHANGED
@@ -1,6 +1,7 @@
1
1
  source 'https://rubygems.org'
2
2
  gemspec
3
3
 
4
+ gem "hiredis"
4
5
  gem 'rails', '~> 4.2'
5
6
  gem 'simplecov'
6
7
  gem 'minitest'
@@ -17,17 +17,15 @@ Sidekiq Pro 3.0 is designed to work with Sidekiq 4.0.
17
17
  * Reliable fetch has been re-implemented due to the fetch changes in
18
18
  Sidekiq 4.0.
19
19
 
20
- * Support for platforms without persistent hostnames. Since reliable fetch
21
- normally requires a persistent hostname, you may disable hostname usage on
22
- platforms like Heroku and Docker:
20
+ * Support for platforms without persistent hostnames. Since the reliable\_fetch
21
+ algorithm requires a persistent hostname, an alternative reliability
22
+ algorithm is now available for platforms like Heroku and Docker:
23
23
  ```ruby
24
24
  Sidekiq.configure_server do |config|
25
- config.options[:ephemeral_hostname] = true
26
- config.reliable_fetch!
25
+ config.timed_fetch!
27
26
  end
28
27
  ```
29
- This option is enabled automatically if Heroku's DYNO environment variable is present.
30
- Without a persistent hostname, each Sidekiq process **must** have its own unique index.
28
+ The wiki contains [much more detail about each reliability option](https://github.com/mperham/sidekiq/wiki/Pro-Reliability-Server).
31
29
 
32
30
  * The old 'sidekiq/notifications' features have been removed.
33
31
 
@@ -3,6 +3,41 @@ Sidekiq Pro Changelog
3
3
 
4
4
  Please see [http://sidekiq.org/](http://sidekiq.org/) for more details and how to buy.
5
5
 
6
+ 3.2.1
7
+ ---------
8
+
9
+ - timed\_fetch now works with namespaces. [ryansch]
10
+
11
+
12
+ 3.2.0
13
+ ---------
14
+
15
+ - Fixed detection of missing batches, `NoSuchBatch` should be raised
16
+ properly now if `Sidekiq::Batch.new(bid)` is called on a batch no
17
+ longer in Redis.
18
+ - Remove support for Pro 1.x format batches. This version will no
19
+ longer seamlessly process batches created with Sidekiq Pro 1.x.
20
+ As always, upgrade one major version at a time to ensure a smooth
21
+ transition.
22
+ - Fix edge case where a parent batch could expire before a child batch
23
+ was finished processing, leading to missing batches [#2889]
24
+
25
+ 2.1.5
26
+ ---------
27
+
28
+ - Fix edge case where a parent batch could expire before a child batch
29
+ was finished processing, leading to missing batches [#2889]
30
+
31
+ 3.1.0
32
+ ---------
33
+
34
+ - New container-friendly fetch algorithm: `timed_fetch`. See the
35
+ [wiki documentation](https://github.com/mperham/sidekiq/wiki/Pro-Reliability-Server)
36
+ for trade offs between the two reliability options. You should
37
+ use this if you are on Heroku, Docker, Amazon ECS or EBS or
38
+ another container-based system.
39
+
40
+
6
41
  3.0.6
7
42
  ---------
8
43
 
data/README.md CHANGED
@@ -18,7 +18,8 @@ message format as Resque so it can integrate into an existing Resque processing
18
18
  You can have Sidekiq and Resque run side-by-side at the same time and
19
19
  use the Resque client to enqueue jobs in Redis to be processed by Sidekiq.
20
20
 
21
- Sidekiq is fast.
21
+ Performance
22
+ ---------------
22
23
 
23
24
  Version | Latency | Garbage created for 10,000 jobs | Time to process 100,000 jobs | Throughput
24
25
  -----------------|------|---------|---------|------------------------
@@ -26,8 +26,8 @@ Toxiproxy.populate([{
26
26
 
27
27
 
28
28
  Sidekiq.configure_server do |config|
29
- config.redis = { db: 13, port: 6380 }
30
- #config.redis = { db: 13 }
29
+ #config.options[:concurrency] = 1
30
+ config.redis = { driver: :hiredis, db: 13, port: 6380 }
31
31
  config.options[:queues] << 'default'
32
32
  config.logger.level = Logger::ERROR
33
33
  config.average_scheduled_poll_interval = 2
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  # encoding: utf-8
2
3
  require 'sidekiq/version'
3
4
  fail "Sidekiq #{Sidekiq::VERSION} does not support Ruby versions below 2.0.0." if RUBY_PLATFORM != 'java' && RUBY_VERSION < '2.0.0'
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  # encoding: utf-8
2
3
  require 'sidekiq'
3
4
 
@@ -195,7 +196,7 @@ module Sidekiq
195
196
  # Return all known queues within Redis.
196
197
  #
197
198
  def self.all
198
- Sidekiq.redis {|c| c.smembers('queues'.freeze) }.sort.map {|q| Sidekiq::Queue.new(q) }
199
+ Sidekiq.redis { |c| c.smembers('queues'.freeze) }.sort.map { |q| Sidekiq::Queue.new(q) }
199
200
  end
200
201
 
201
202
  attr_reader :name
@@ -277,6 +278,7 @@ module Sidekiq
277
278
  #
278
279
  class Job
279
280
  attr_reader :item
281
+ attr_reader :value
280
282
 
281
283
  def initialize(item, queue_name=nil)
282
284
  @value = item
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  # encoding: utf-8
2
3
  $stdout.sync = true
3
4
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'securerandom'
2
3
  require 'sidekiq/middleware/chain'
3
4
 
@@ -82,10 +83,14 @@ module Sidekiq
82
83
  # Returns an array of the of pushed jobs' jids. The number of jobs pushed can be less
83
84
  # than the number given if the middleware stopped processing for one or more jobs.
84
85
  def push_bulk(items)
86
+ arg = items['args'].first
87
+ raise ArgumentError, "Bulk arguments must be an Array of Arrays: [[1], [2]]" if !arg.is_a?(Array)
88
+
85
89
  normed = normalize_item(items)
86
90
  payloads = items['args'].map do |args|
87
- raise ArgumentError, "Bulk arguments must be an Array of Arrays: [[1], [2]]" if !args.is_a?(Array)
88
- process_single(items['class'], normed.merge('args' => args, 'jid' => SecureRandom.hex(12), 'enqueued_at' => Time.now.to_f))
91
+ copy = normed.merge('args' => args, 'jid' => SecureRandom.hex(12), 'enqueued_at' => Time.now.to_f)
92
+ result = process_single(items['class'], copy)
93
+ result ? result : nil
89
94
  end.compact
90
95
 
91
96
  raw_push(payloads) if !payloads.empty?
@@ -106,7 +111,8 @@ module Sidekiq
106
111
  # you cannot scale any other way (e.g. splitting your app into smaller apps).
107
112
  def self.via(pool)
108
113
  raise ArgumentError, "No pool given" if pool.nil?
109
- raise RuntimeError, "Sidekiq::Client.via is not re-entrant" if x = Thread.current[:sidekiq_via_pool] && x != pool
114
+ current_sidekiq_pool = Thread.current[:sidekiq_via_pool]
115
+ raise RuntimeError, "Sidekiq::Client.via is not re-entrant" if current_sidekiq_pool && current_sidekiq_pool != pool
110
116
  Thread.current[:sidekiq_via_pool] = pool
111
117
  yield
112
118
  ensure
@@ -205,6 +211,7 @@ module Sidekiq
205
211
  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)
206
212
  raise(ArgumentError, "Job args must be an Array") unless item['args'].is_a?(Array)
207
213
  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)
214
+ #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']
208
215
 
209
216
  normalized_hash(item['class'.freeze])
210
217
  .each{ |key, value| item[key] = value if item[key].nil? }
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  begin
2
3
  require 'active_support/core_ext/class/attribute'
3
4
  rescue LoadError
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'sidekiq'
2
3
 
3
4
  module Sidekiq
@@ -5,7 +6,7 @@ module Sidekiq
5
6
 
6
7
  class Logger
7
8
  def call(ex, ctxHash)
8
- Sidekiq.logger.warn(ctxHash) if !ctxHash.empty?
9
+ Sidekiq.logger.warn(Sidekiq.dump_json(ctxHash)) if !ctxHash.empty?
9
10
  Sidekiq.logger.warn "#{ex.class.name}: #{ex.message}"
10
11
  Sidekiq.logger.warn ex.backtrace.join("\n") unless ex.backtrace.nil?
11
12
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'sidekiq/extensions/generic_proxy'
2
3
 
3
4
  module Sidekiq
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'sidekiq/extensions/generic_proxy'
2
3
 
3
4
  module Sidekiq
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'sidekiq/extensions/generic_proxy'
2
3
 
3
4
  module Sidekiq
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'yaml'
2
3
 
3
4
  module Sidekiq
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'sidekiq'
2
3
 
3
4
  module Sidekiq
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  # encoding: utf-8
2
3
  require 'sidekiq/manager'
3
4
  require 'sidekiq/fetch'
@@ -88,6 +89,7 @@ module Sidekiq
88
89
  Processor::WORKER_STATE.each_pair do |tid, hash|
89
90
  conn.hset(workers_key, tid, Sidekiq.dump_json(hash))
90
91
  end
92
+ conn.expire(workers_key, 60)
91
93
  end
92
94
  end
93
95
  fails = procd = 0
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'time'
2
3
  require 'logger'
3
4
  require 'fcntl'
@@ -47,7 +48,7 @@ module Sidekiq
47
48
  end
48
49
 
49
50
  def self.logger=(log)
50
- @logger = (log ? log : Logger.new('/dev/null'))
51
+ @logger = (log ? log : Logger.new(File::NULL))
51
52
  end
52
53
 
53
54
  # This reopens ALL logfiles in the process that have been rotated
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  # encoding: utf-8
2
3
  require 'sidekiq/util'
3
4
  require 'sidekiq/processor'
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Sidekiq
2
3
  # Middleware is code configured to run before/after
3
4
  # a message is processed. It is patterned after Rack
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  #
2
3
  # Simple middleware to save the current locale and restore it when the job executes.
3
4
  # Use it by requiring it in your initializer:
@@ -8,14 +8,14 @@ module Sidekiq
8
8
  # Automatically retry jobs that fail in Sidekiq.
9
9
  # Sidekiq's retry support assumes a typical development lifecycle:
10
10
  #
11
- # 0. push some code changes with a bug in it
12
- # 1. bug causes job processing to fail, sidekiq's middleware captures
13
- # the job and pushes it onto a retry queue
14
- # 2. sidekiq retries jobs in the retry queue multiple times with
15
- # an exponential delay, the job continues to fail
16
- # 3. after a few days, a developer deploys a fix. the job is
11
+ # 0. Push some code changes with a bug in it.
12
+ # 1. Bug causes job processing to fail, Sidekiq's middleware captures
13
+ # the job and pushes it onto a retry queue.
14
+ # 2. Sidekiq retries jobs in the retry queue multiple times with
15
+ # an exponential delay, the job continues to fail.
16
+ # 3. After a few days, a developer deploys a fix. The job is
17
17
  # reprocessed successfully.
18
- # 4. once retries are exhausted, sidekiq will give up and move the
18
+ # 4. Once retries are exhausted, Sidekiq will give up and move the
19
19
  # job to the Dead Job Queue (aka morgue) where it must be dealt with
20
20
  # manually in the Web UI.
21
21
  # 5. After 6 months on the DJQ, Sidekiq will discard the job.
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Sidekiq
2
3
  module Paginator
3
4
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'sidekiq/util'
2
3
  require 'sidekiq/fetch'
3
4
  require 'thread'
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Sidekiq
2
3
  def self.hook_rails!
3
4
  return if defined?(@delay_removed)
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'connection_pool'
2
3
  require 'redis'
3
4
  require 'uri'
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'sidekiq'
2
3
  require 'sidekiq/util'
3
4
  require 'sidekiq/api'
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'securerandom'
2
3
  require 'sidekiq'
3
4
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'sidekiq/testing'
2
3
 
3
4
  ##
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'socket'
2
3
  require 'securerandom'
3
4
  require 'sidekiq/exception_handler'
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Sidekiq
2
- VERSION = "4.1.1"
3
+ VERSION = "4.1.2"
3
4
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'erb'
2
3
  require 'yaml'
3
4
  require 'sinatra/base'
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'uri'
2
3
 
3
4
  module Sidekiq
@@ -166,7 +167,7 @@ module Sidekiq
166
167
 
167
168
  def display_args(args, truncate_after_chars = 2000)
168
169
  args.map do |arg|
169
- h(truncate(to_display(arg)))
170
+ h(truncate(to_display(arg), truncate_after_chars))
170
171
  end.join(", ")
171
172
  end
172
173
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'sidekiq/client'
2
3
  require 'sidekiq/core_ext'
3
4
 
@@ -0,0 +1 @@
1
+ # frozen_string_literal: true
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  $TESTING = true
2
3
  # disable minitest/parallel threads
3
4
  ENV["N"] = "0"
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require_relative 'helper'
2
3
  require 'sidekiq/cli'
3
4
  require 'sidekiq/fetch'
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require_relative 'helper'
2
3
  require 'sidekiq/api'
3
4
  require 'active_job'
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require_relative 'helper'
2
3
  require 'sidekiq/cli'
3
4
  require 'tempfile'
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require_relative 'helper'
2
3
 
3
4
  class TestClient < Sidekiq::Test
@@ -32,6 +33,23 @@ class TestClient < Sidekiq::Test
32
33
  assert_equal 24, jid.size
33
34
  end
34
35
 
36
+ it 'allows middleware to stop bulk jobs' do
37
+ mware = Class.new do
38
+ def call(worker_klass,msg,q,r)
39
+ msg['args'][0] == 1 ? yield : false
40
+ end
41
+ end
42
+ client = Sidekiq::Client.new
43
+ client.middleware do |chain|
44
+ chain.add mware
45
+ end
46
+ q = Sidekiq::Queue.new
47
+ q.clear
48
+ result = client.push_bulk('class' => 'Blah', 'args' => [[1],[2],[3]])
49
+ assert_equal 1, result.size
50
+ assert_equal 1, q.size
51
+ end
52
+
35
53
  it 'allows local middleware modification' do
36
54
  $called = false
37
55
  mware = Class.new { def call(worker_klass,msg,q,r); $called = true; msg;end }
@@ -164,6 +182,18 @@ class TestClient < Sidekiq::Test
164
182
  conn.verify
165
183
  end
166
184
 
185
+ it 'allows #via to point to same Redi' do
186
+ conn = MiniTest::Mock.new
187
+ conn.expect(:multi, [0, 1])
188
+ sharded_pool = ConnectionPool.new(size: 1) { conn }
189
+ Sidekiq::Client.via(sharded_pool) do
190
+ Sidekiq::Client.via(sharded_pool) do
191
+ CWorker.perform_async(1,2,3)
192
+ end
193
+ end
194
+ conn.verify
195
+ end
196
+
167
197
  it 'allows #via to point to different Redi' do
168
198
  conn = MiniTest::Mock.new
169
199
  conn.expect(:multi, [0, 1])
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require_relative 'helper'
2
3
  require 'sidekiq/exception_handler'
3
4
  require 'stringio'
@@ -32,7 +33,7 @@ class TestExceptionHandler < Sidekiq::Test
32
33
  Component.new.invoke_exception(:a => 1)
33
34
  @str_logger.rewind
34
35
  log = @str_logger.readlines
35
- assert_match(/a=>1/, log[0], "didn't include the context")
36
+ assert_match(/"a":1/, log[0], "didn't include the context")
36
37
  assert_match(/Something didn't work!/, log[1], "didn't include the exception message")
37
38
  assert_match(/test\/test_exception_handler.rb/, log[2], "didn't include the backtrace")
38
39
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require_relative 'helper'
2
3
  require 'sidekiq'
3
4
  require 'active_record'
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require_relative 'helper'
2
3
  require 'sidekiq/fetch'
3
4
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require_relative 'helper'
2
3
  require 'sidekiq/launcher'
3
4
 
@@ -55,6 +56,10 @@ class TestLauncher < Sidekiq::Test
55
56
  @launcher.heartbeat('identity', heartbeat_data, Sidekiq.dump_json(heartbeat_data))
56
57
  end
57
58
 
59
+ #after do
60
+ #puts system('redis-cli -n 15 keys "*" | while read LINE ; do TTL=`redis-cli -n 15 ttl "$LINE"`; if [ "$TTL" -eq -1 ]; then echo "$LINE"; fi; done;')
61
+ #end
62
+
58
63
  it 'indicates stopping status in proctitle' do
59
64
  assert_equal "sidekiq #{Sidekiq::VERSION} myapp [1 of 3 busy] stopping", $0
60
65
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require_relative 'helper'
2
3
  require 'sidekiq/logging'
3
4
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require_relative 'helper'
2
3
  require 'sidekiq/manager'
3
4
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require_relative 'helper'
2
3
  require 'sidekiq/middleware/chain'
3
4
  require 'sidekiq/processor'
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require_relative 'helper'
2
3
  require 'sidekiq/fetch'
3
4
  require 'sidekiq/cli'
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require_relative 'helper'
2
3
 
3
4
  $HAS_AJ = true
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require_relative 'helper'
2
3
 
3
4
  class TestRedisConnection < Sidekiq::Test
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  # encoding: utf-8
2
3
  require_relative 'helper'
3
4
  require 'sidekiq/scheduled'
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require_relative 'helper'
2
3
  require 'sidekiq/scheduled'
3
4
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require_relative 'helper'
2
3
  require 'sidekiq/scheduled'
3
4
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  # encoding: utf-8
2
3
  require_relative 'helper'
3
4
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require_relative 'helper'
2
3
 
3
4
  require 'active_record'
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require_relative 'helper'
2
3
 
3
4
  require 'active_record'
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require_relative 'helper'
2
3
 
3
4
  require 'active_record'
@@ -86,7 +87,7 @@ class TestInline < Sidekiq::Test
86
87
  end
87
88
 
88
89
  it 'should relay parameters through json' do
89
- assert Sidekiq::Client.enqueue(InlineWorkerWithTimeParam, Time.now)
90
+ assert Sidekiq::Client.enqueue(InlineWorkerWithTimeParam, Time.now.to_f)
90
91
  end
91
92
 
92
93
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require_relative 'helper'
2
3
 
3
4
  class TestUtil < Sidekiq::Test
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  # encoding: utf-8
2
3
  require_relative 'helper'
3
4
  require 'sidekiq/web'
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require_relative 'helper'
2
3
 
3
4
  class TestWebHelpers < Sidekiq::Test
@@ -76,3 +76,4 @@ en: # <---- change this to your locale code
76
76
  Plugins: Plugins
77
77
  NotYetEnqueued: Not yet enqueued
78
78
  CreatedAt: Created At
79
+ BackToApp: Back to App
@@ -73,3 +73,6 @@ ru:
73
73
  QuietAll: Отдыхать всем
74
74
  PollingInterval: Интервал опроса
75
75
  Plugins: Плагины
76
+ NotYetEnqueued: Пока не в очереди
77
+ CreatedAt: Создан
78
+ BackToApp: Назад
@@ -56,7 +56,7 @@
56
56
  <div class="poll-wrapper pull-right">
57
57
  <%= erb :_poll_link %>
58
58
  <% if Sidekiq::Web.app_url %>
59
- <a class="btn btn-inverse" href="<%= Sidekiq::Web.app_url %>">Back to App</a>
59
+ <a class="btn btn-inverse" href="<%= Sidekiq::Web.app_url %>"><%= t('BackToApp') %></a>
60
60
  <% end %>
61
61
  </div>
62
62
  </li>
@@ -6,8 +6,8 @@
6
6
  <form method="POST" style="margin-top: 20px; margin-bottom: 10px;">
7
7
  <%= csrf_tag %>
8
8
  <div class="btn-group pull-right">
9
- <button class="btn btn-warn" type="submit" name="quiet" value="1"><%= t('QuietAll') %></button>
10
- <button class="btn btn-danger" type="submit" name="stop" value="1"><%= t('StopAll') %></button>
9
+ <button class="btn btn-warn" type="submit" name="quiet" value="1" data-confirm="<%= t('AreYouSure') %>"><%= t('QuietAll') %></button>
10
+ <button class="btn btn-danger" type="submit" name="stop" value="1" data-confirm="<%= t('AreYouSure') %>"><%= t('StopAll') %></button>
11
11
  </div>
12
12
  </form>
13
13
  </div>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sidekiq
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.1
4
+ version: 4.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Perham
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-04 00:00:00.000000000 Z
11
+ date: 2016-05-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redis
@@ -404,3 +404,4 @@ test_files:
404
404
  - test/test_util.rb
405
405
  - test/test_web.rb
406
406
  - test/test_web_helpers.rb
407
+ has_rdoc: