sidekiq 5.0.0.rc1 → 5.0.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of sidekiq might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6d7e0b4092aa035c45d6dd4893cd470bb9a249d6
4
- data.tar.gz: fbb9d06f9875133960daf397b8c338ca74c2d225
3
+ metadata.gz: f2a9cd7270e53981aaf7b3f2639596ff042f5ae3
4
+ data.tar.gz: 7b6e4fbfee794de34d9b6b15772cbf085e05a65b
5
5
  SHA512:
6
- metadata.gz: f1dd673960ace0f7e30a09bb480de64265a64b997042b65c8cb0057757129def2005c75b6f017c3b5fb589681c2f2180e2f0b8f698f4ac63ef9bf44b641ad426
7
- data.tar.gz: d9a1a3270d371bf7d7bddf98d103e6be2886a4dd6acbb08c1d5edd7b951b7f8d91d11e56c0892e10c6e6981f028ea8d64db5900cef0c3cb4023b91a9adbb30cd
6
+ metadata.gz: dfaecc27ce4071e36b5ab994c27f59d85b4cf7f16ca05a5b786c79125c311f58fbb38b94f7e1c71e4dbf90e6645cb358102e8940a94881981f7bbc2578fd18ff
7
+ data.tar.gz: a98e9b87e5f4abe2580ea5fcb6f20ef1d28623eae9be4ca758d5f5b52c65dbef7a6b5df74f673449177f36494b9075573315c7ef6cd6b757ba6a59e825737833
data/Changes.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Sidekiq Changes
2
2
 
3
+ [Sidekiq Changes](https://github.com/mperham/sidekiq/blob/master/Changes.md) | [Sidekiq Pro Changes](https://github.com/mperham/sidekiq/blob/master/Pro-Changes.md) | [Sidekiq Enterprise Changes](https://github.com/mperham/sidekiq/blob/master/Ent-Changes.md)
4
+
3
5
  5.0.0
4
6
  -----------
5
7
 
@@ -16,6 +18,9 @@ Sidekiq::Middleware::Server::Logging -> Sidekiq::JobLogging
16
18
  must opt into them.
17
19
  - The Web UI is now BiDi and can render RTL languages like Arabic, Farsi and Hebrew.
18
20
  - Rails 3.2 and Ruby 2.0 and 2.1 are no longer supported.
21
+ - The `SomeWorker.set(options)` API was re-written to avoid thread-local state. [#2152]
22
+ - Sidekiq Enterprise's encrypted jobs now display "[encrypted data]" in the Web UI instead
23
+ of random hex bytes.
19
24
  - Please see the [5.0 Upgrade notes](5.0-Upgrade.md) for more detail.
20
25
 
21
26
  4.2.10
@@ -1,5 +1,6 @@
1
- Sidekiq Enterprise Changelog
2
- =======================
1
+ # Sidekiq Enterprise Changelog
2
+
3
+ [Sidekiq Changes](https://github.com/mperham/sidekiq/blob/master/Changes.md) | [Sidekiq Pro Changes](https://github.com/mperham/sidekiq/blob/master/Pro-Changes.md) | [Sidekiq Enterprise Changes](https://github.com/mperham/sidekiq/blob/master/Ent-Changes.md)
3
4
 
4
5
  Please see [http://sidekiq.org/](http://sidekiq.org/) for more details and how to buy.
5
6
 
@@ -1,5 +1,6 @@
1
- Sidekiq Pro Changelog
2
- =======================
1
+ # Sidekiq Pro Changelog
2
+
3
+ [Sidekiq Changes](https://github.com/mperham/sidekiq/blob/master/Changes.md) | [Sidekiq Pro Changes](https://github.com/mperham/sidekiq/blob/master/Pro-Changes.md) | [Sidekiq Enterprise Changes](https://github.com/mperham/sidekiq/blob/master/Ent-Changes.md)
3
4
 
4
5
  Please see [http://sidekiq.org/](http://sidekiq.org/) for more details and how to buy.
5
6
 
@@ -12,7 +12,7 @@ require 'sidekiq/delay'
12
12
  require 'json'
13
13
 
14
14
  module Sidekiq
15
- NAME = 'Sidekiq'
15
+ NAME = 'Sidekiq'.freeze
16
16
  LICENSE = 'See LICENSE and the LGPL-3.0 for licensing details.'
17
17
 
18
18
  DEFAULTS = {
@@ -338,12 +338,16 @@ module Sidekiq
338
338
  when "ActiveJob::QueueAdapters::SidekiqAdapter::JobWrapper"
339
339
  job_args = self['wrapped'] ? args[0]["arguments"] : []
340
340
  if 'ActionMailer::DeliveryJob' == (self['wrapped'] || args[0])
341
- # remove MailerClass, mailer_method and 'deliver_now'
342
- job_args.drop(3)
341
+ # remove MailerClass, mailer_method and 'deliver_now'
342
+ job_args.drop(3)
343
343
  else
344
- job_args
344
+ job_args
345
345
  end
346
346
  else
347
+ if self['encrypt'.freeze]
348
+ # no point in showing 150+ bytes of random garbage
349
+ args[-1] = '[encrypted data]'.freeze
350
+ end
347
351
  args
348
352
  end
349
353
  end
@@ -63,11 +63,11 @@ module Sidekiq
63
63
  #
64
64
  def push(item)
65
65
  normed = normalize_item(item)
66
- payload = process_single(item['class'], normed)
66
+ payload = process_single(item['class'.freeze], normed)
67
67
 
68
68
  if payload
69
69
  raw_push([payload])
70
- payload['jid']
70
+ payload['jid'.freeze]
71
71
  end
72
72
  end
73
73
 
@@ -84,19 +84,19 @@ module Sidekiq
84
84
  # Returns an array of the of pushed jobs' jids. The number of jobs pushed can be less
85
85
  # than the number given if the middleware stopped processing for one or more jobs.
86
86
  def push_bulk(items)
87
- arg = items['args'].first
87
+ arg = items['args'.freeze].first
88
88
  return [] unless arg # no jobs to push
89
89
  raise ArgumentError, "Bulk arguments must be an Array of Arrays: [[1], [2]]" if !arg.is_a?(Array)
90
90
 
91
91
  normed = normalize_item(items)
92
- payloads = items['args'].map do |args|
93
- copy = normed.merge('args' => args, 'jid' => SecureRandom.hex(12), 'enqueued_at' => Time.now.to_f)
94
- result = process_single(items['class'], copy)
92
+ payloads = items['args'.freeze].map do |args|
93
+ copy = normed.merge('args'.freeze => args, 'jid'.freeze => SecureRandom.hex(12), 'enqueued_at'.freeze => Time.now.to_f)
94
+ result = process_single(items['class'.freeze], copy)
95
95
  result ? result : nil
96
96
  end.compact
97
97
 
98
98
  raw_push(payloads) if !payloads.empty?
99
- payloads.collect { |payload| payload['jid'] }
99
+ payloads.collect { |payload| payload['jid'.freeze] }
100
100
  end
101
101
 
102
102
  # Allows sharding of jobs across any number of Redis instances. All jobs
@@ -140,14 +140,14 @@ module Sidekiq
140
140
  # Messages are enqueued to the 'default' queue.
141
141
  #
142
142
  def enqueue(klass, *args)
143
- klass.client_push('class' => klass, 'args' => args)
143
+ klass.client_push('class'.freeze => klass, 'args'.freeze => args)
144
144
  end
145
145
 
146
146
  # Example usage:
147
147
  # Sidekiq::Client.enqueue_to(:queue_name, MyWorker, 'foo', 1, :bat => 'bar')
148
148
  #
149
149
  def enqueue_to(queue, klass, *args)
150
- klass.client_push('queue' => queue, 'class' => klass, 'args' => args)
150
+ klass.client_push('queue'.freeze => queue, 'class'.freeze => klass, 'args'.freeze => args)
151
151
  end
152
152
 
153
153
  # Example usage:
@@ -158,7 +158,7 @@ module Sidekiq
158
158
  now = Time.now.to_f
159
159
  ts = (int < 1_000_000_000 ? now + int : int)
160
160
 
161
- item = { 'class' => klass, 'args' => args, 'at' => ts, 'queue' => queue }
161
+ item = { 'class'.freeze => klass, 'args'.freeze => args, 'at'.freeze => ts, 'queue'.freeze => queue }
162
162
  item.delete('at'.freeze) if ts <= now
163
163
 
164
164
  klass.client_push(item)
@@ -184,13 +184,13 @@ module Sidekiq
184
184
  end
185
185
 
186
186
  def atomic_push(conn, payloads)
187
- if payloads.first['at']
187
+ if payloads.first['at'.freeze]
188
188
  conn.zadd('schedule'.freeze, payloads.map do |hash|
189
189
  at = hash.delete('at'.freeze).to_s
190
190
  [at, Sidekiq.dump_json(hash)]
191
191
  end)
192
192
  else
193
- q = payloads.first['queue']
193
+ q = payloads.first['queue'.freeze]
194
194
  now = Time.now.to_f
195
195
  to_push = payloads.map do |entry|
196
196
  entry['enqueued_at'.freeze] = now
@@ -202,7 +202,7 @@ module Sidekiq
202
202
  end
203
203
 
204
204
  def process_single(worker_class, item)
205
- queue = item['queue']
205
+ queue = item['queue'.freeze]
206
206
 
207
207
  middleware.invoke(worker_class, item, queue, @redis_pool) do
208
208
  item
@@ -67,7 +67,7 @@ module Sidekiq
67
67
  opts.delete(:network_timeout)
68
68
  end
69
69
 
70
- opts[:driver] ||= 'ruby'
70
+ opts[:driver] ||= 'ruby'.freeze
71
71
 
72
72
  # Issue #3303, redis-rb will silently retry an operation.
73
73
  # This can lead to duplicate jobs if Sidekiq::Client's LPUSH
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Sidekiq
3
- VERSION = "5.0.0.rc1"
3
+ VERSION = "5.0.0"
4
4
  end
@@ -4,6 +4,7 @@ require 'sidekiq/core_ext'
4
4
 
5
5
  module Sidekiq
6
6
 
7
+
7
8
  ##
8
9
  # Include this module in your worker class and you can easily create
9
10
  # asynchronous jobs:
@@ -37,6 +38,34 @@ module Sidekiq
37
38
  Sidekiq.logger
38
39
  end
39
40
 
41
+ # This helper class encapsulates the set options for `set`, e.g.
42
+ #
43
+ # SomeWorker.set(queue: 'foo').perform_async(....)
44
+ #
45
+ class Setter
46
+ def initialize(opts)
47
+ @opts = opts
48
+ end
49
+
50
+ def perform_async(*args)
51
+ @opts['class'.freeze].client_push(@opts.merge!('args'.freeze => args))
52
+ end
53
+
54
+ # +interval+ must be a timestamp, numeric or something that acts
55
+ # numeric (like an activesupport time interval).
56
+ def perform_in(interval, *args)
57
+ int = interval.to_f
58
+ now = Time.now.to_f
59
+ ts = (int < 1_000_000_000 ? now + int : int)
60
+
61
+ @opts.merge! 'args'.freeze => args, 'at'.freeze => ts
62
+ # Optimization to enqueue something now that is scheduled to go out now or in the past
63
+ @opts.delete('at'.freeze) if ts <= now
64
+ @opts['class'.freeze].client_push(@opts)
65
+ end
66
+ alias_method :perform_at, :perform_in
67
+ end
68
+
40
69
  module ClassMethods
41
70
 
42
71
  def delay(*args)
@@ -52,12 +81,11 @@ module Sidekiq
52
81
  end
53
82
 
54
83
  def set(options)
55
- Thread.current[:sidekiq_worker_set] = options
56
- self
84
+ Setter.new(options.merge!('class'.freeze => self))
57
85
  end
58
86
 
59
87
  def perform_async(*args)
60
- client_push('class' => self, 'args' => args)
88
+ client_push('class'.freeze => self, 'args'.freeze => args)
61
89
  end
62
90
 
63
91
  # +interval+ must be a timestamp, numeric or something that acts
@@ -67,7 +95,7 @@ module Sidekiq
67
95
  now = Time.now.to_f
68
96
  ts = (int < 1_000_000_000 ? now + int : int)
69
97
 
70
- item = { 'class' => self, 'args' => args, 'at' => ts }
98
+ item = { 'class'.freeze => self, 'args'.freeze => args, 'at'.freeze => ts }
71
99
 
72
100
  # Optimization to enqueue something now that is scheduled to go out now or in the past
73
101
  item.delete('at'.freeze) if ts <= now
@@ -106,13 +134,8 @@ module Sidekiq
106
134
  end
107
135
 
108
136
  def client_push(item) # :nodoc:
109
- pool = Thread.current[:sidekiq_via_pool] || get_sidekiq_options['pool'] || Sidekiq.redis_pool
110
- hash = if Thread.current[:sidekiq_worker_set]
111
- x, Thread.current[:sidekiq_worker_set] = Thread.current[:sidekiq_worker_set], nil
112
- x.stringify_keys.merge(item.stringify_keys)
113
- else
114
- item.stringify_keys
115
- end
137
+ pool = Thread.current[:sidekiq_via_pool] || get_sidekiq_options['pool'.freeze] || Sidekiq.redis_pool
138
+ hash = item.stringify_keys
116
139
  Sidekiq::Client.new(pool).push(hash)
117
140
  end
118
141
 
@@ -15,7 +15,7 @@ Gem::Specification.new do |gem|
15
15
  gem.name = "sidekiq"
16
16
  gem.require_paths = ["lib"]
17
17
  gem.version = Sidekiq::VERSION
18
- gem.add_dependency 'redis', '~> 3.2', '>= 3.2.1'
18
+ gem.add_dependency 'redis', '~> 3.3', '>= 3.3.3'
19
19
  gem.add_dependency 'connection_pool', '~> 2.2', '>= 2.2.0'
20
20
  gem.add_dependency 'concurrent-ruby', '~> 1.0'
21
21
  gem.add_dependency 'rack-protection', '>= 1.5.0'
@@ -7,7 +7,7 @@ he:
7
7
  Realtime: זמן אמת
8
8
  History: היסטוריה
9
9
  Busy: עסוקים
10
- Processed: מעובדים
10
+ Processed: עובדו
11
11
  Failed: נכשלו
12
12
  Scheduled: מתוכננים
13
13
  Retries: נסיונות חוזרים
@@ -34,24 +34,24 @@ he:
34
34
  RetryCount: מספר נסיונות חוזרים
35
35
  RetryNow: נסה שוב עכשיו
36
36
  Kill: הרוג
37
- LastRetry: ניסיון חוזר האחרון
37
+ LastRetry: ניסיון חוזר אחרון
38
38
  OriginallyFailed: נכשל בניסיון הראשון
39
39
  AreYouSure: אתם בטוחים?
40
40
  DeleteAll: מחק הכל
41
41
  RetryAll: נסה שוב את הכל
42
42
  NoRetriesFound: לא נמצאו נסיונות חוזרים
43
43
  Error: שגיאה
44
- ErrorClass: מחלקת השגיאה
45
- ErrorMessage: מסר השגיאה
44
+ ErrorClass: סוג השגיאה
45
+ ErrorMessage: הודעת השגיאה
46
46
  ErrorBacktrace: מעקב לאחור של השגיאה
47
47
  GoBack: ← אחורה
48
48
  NoScheduledFound: לא נמצאו עבודות מתוכננות
49
49
  When: מתי
50
50
  ScheduledJobs: עבודות מתוכננות
51
- idle: סרק
51
+ idle: במנוחה
52
52
  active: פעיל
53
53
  Version: גירסה
54
- Connections: קישורים
54
+ Connections: חיבורים
55
55
  MemoryUsage: שימוש בזיכרון
56
56
  PeakMemoryUsage: שיא השימוש בזיכרון
57
57
  Uptime: זמן פעילות (ימים)
@@ -64,15 +64,15 @@ he:
64
64
  NoDeadJobsFound: לא נמצאו עבודות מתות
65
65
  Dead: מתים
66
66
  Processes: תהליכים
67
- Thread: נים
68
- Threads: נימים
67
+ Thread: חוט
68
+ Threads: חוטים
69
69
  Jobs: עבודות
70
- Paused: נפסקים
70
+ Paused: הופסקו
71
71
  Stop: עצור
72
72
  Quiet: שקט
73
- StopAll: עצור את כולם
73
+ StopAll: עצור הכל
74
74
  QuietAll: השקט את כולם
75
- PollingInterval: רווח בין תשאולים
75
+ PollingInterval: מרווח זמן בין תשאולים
76
76
  Plugins: תוספים
77
77
  NotYetEnqueued: עוד לא בתור
78
78
  CreatedAt: נוצר ב
@@ -22,13 +22,13 @@
22
22
  <tr>
23
23
  <td><%= h(msg.display_class) %></td>
24
24
  <td>
25
- <% a = msg.display_args.inspect %>
26
- <% if a.size > 100 %>
27
- <span class="worker_<%= index %>"><%= h(msg.display_args.inspect[0..100]) + "... " %></span>
25
+ <% a = msg.display_args %>
26
+ <% if a.inspect.size > 100 %>
27
+ <span class="worker_<%= index %>"><%= h(a.inspect[0..100]) + "... " %></span>
28
28
  <button data-toggle="collapse" data-target=".worker_<%= index %>" class="btn btn-default btn-xs"><%= t('ShowAll') %></button>
29
- <div class="toggle worker_<%= index %>"><%= h(msg.display_args) %></div>
29
+ <div class="toggle worker_<%= index %>"><%= display_args(a) %></div>
30
30
  <% else %>
31
- <%= h(msg.display_args) %>
31
+ <%= display_args(msg.display_args) %>
32
32
  <% end %>
33
33
  </td>
34
34
  <td>
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: 5.0.0.rc1
4
+ version: 5.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Perham
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-04 00:00:00.000000000 Z
11
+ date: 2017-04-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redis
@@ -16,20 +16,20 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '3.2'
19
+ version: '3.3'
20
20
  - - ">="
21
21
  - !ruby/object:Gem::Version
22
- version: 3.2.1
22
+ version: 3.3.3
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - "~>"
28
28
  - !ruby/object:Gem::Version
29
- version: '3.2'
29
+ version: '3.3'
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
- version: 3.2.1
32
+ version: 3.3.3
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: connection_pool
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -354,9 +354,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
354
354
  version: '0'
355
355
  required_rubygems_version: !ruby/object:Gem::Requirement
356
356
  requirements:
357
- - - ">"
357
+ - - ">="
358
358
  - !ruby/object:Gem::Version
359
- version: 1.3.1
359
+ version: '0'
360
360
  requirements: []
361
361
  rubyforge_project:
362
362
  rubygems_version: 2.5.2