sidekiq 3.0.0 → 3.0.1

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: 6924f9ac5a08e3bfb8b20204262b281082a590c9
4
- data.tar.gz: db0c1c65e0f8ca499771c8f68174cc889a977e79
3
+ metadata.gz: 93d056a574eb27c83e3308da80180846a5378d69
4
+ data.tar.gz: 1885563fea28763432f157d911e1860ffa845919
5
5
  SHA512:
6
- metadata.gz: 541f6b4546da89be32045f56d4e5dd41aa9d97d03860ee4fdde696cfb88d9b6ca68d4fb5f83377696d4ee1a9fe572d129afe8c5ddfebb61809302ed0cd54f88c
7
- data.tar.gz: d396cad4b53238a174c722a92e485fb8657664d1965ea826c264c2aab1e5e25991023edce4556e3ceff05250bccf02892190b9fa69a1bc1c40944a71cb20d445
6
+ metadata.gz: 4151032b8a44f021855169594fd69c36e7e6217fd051723e90019c4144a928b2c4715c6dc5167cbbdeecc1cea86fdcc9392524ae4597d2eab2bc1f32d929d880
7
+ data.tar.gz: ed392bf5ea410c79ca0b08f05c72f454df90d852c777b66e17b1cee54e54ea7a534322738b0258958ac67e4a626c0078ef71b7007f367286938bb5a8dff2fa79
data/Changes.md CHANGED
@@ -1,7 +1,19 @@
1
- 3.0.0
1
+ 3.0.1
2
2
  -----------
3
3
 
4
- **Not yet released**
4
+ - Revert pidfile behavior from 2.17.5: Sidekiq will no longer remove its own pidfile
5
+ as this is a race condition when restarting. [#1470, #1677]
6
+ - Show warning on the Queues page if a queue is paused [#1672]
7
+ - Only activate the ActiveRecord middleware if ActiveRecord::Base is defined on boot. [#1666]
8
+ - Add ability to disable jobs going to the DJQ with the `dead` option.
9
+ ```ruby
10
+ sidekiq_options :dead => false, :retry => 5
11
+ ```
12
+ - Minor fixes
13
+
14
+
15
+ 3.0.0
16
+ -----------
5
17
 
6
18
  Please see [3.0-Upgrade.md](3.0-Upgrade.md) for more comprehensive upgrade notes.
7
19
 
@@ -3,7 +3,21 @@ Sidekiq Pro Changelog
3
3
 
4
4
  Please see [http://sidekiq.org/pro](http://sidekiq.org/pro) for more details and how to buy.
5
5
 
6
- HEAD
6
+ 1.7.0
7
+ -----------
8
+
9
+ - Add ability to pause reliable queues via API.
10
+ ```ruby
11
+ q = Sidekiq::Queue.new("critical")
12
+ q.pause!
13
+ q.paused? # => true
14
+ q.unpause!
15
+ ```
16
+
17
+ Sidekiq polls Redis every 10 seconds for paused queues so pausing will take
18
+ a few seconds to take effect.
19
+
20
+ 1.6.0
7
21
  -----------
8
22
 
9
23
  - Compatible with Sidekiq 3.
@@ -17,7 +31,6 @@ HEAD
17
31
  1.5.0
18
32
  -----------
19
33
 
20
- - Compatible with upcoming Sidekiq 3.0 release
21
34
  - Fix issue on Heroku where reliable fetch could orphan jobs [#1573]
22
35
 
23
36
 
data/README.md CHANGED
@@ -78,6 +78,13 @@ If you have a problem, please review the [FAQ](https://github.com/mperham/sideki
78
78
  The mailing list is the preferred place to ask questions on usage. If you are encountering what you think is a bug, please open an issue.
79
79
 
80
80
 
81
+ Thanks
82
+ -----------------
83
+
84
+ Sidekiq stays fast by using the [JProfiler java profiler](http://www.ej-technologies.com/products/jprofiler/overview.html) to find and fix
85
+ performance problems on JRuby. Unfortunately MRI does not have good profile tooling.
86
+
87
+
81
88
  License
82
89
  -----------------
83
90
 
@@ -117,6 +117,9 @@ module Sidekiq
117
117
  Sidekiq::Logging.logger = log
118
118
  end
119
119
 
120
+ # The default poll interval is 15 seconds. This should generally be set to
121
+ # (Sidekiq process count * 5). So if you have a dozen Sidekiq processes, set
122
+ # poll_interval to 60.
120
123
  def self.poll_interval=(interval)
121
124
  self.options[:poll_interval] = interval
122
125
  end
@@ -132,6 +132,11 @@ module Sidekiq
132
132
  Sidekiq.redis { |con| con.llen(@rname) }
133
133
  end
134
134
 
135
+ # Sidekiq Pro overrides this
136
+ def paused?
137
+ false
138
+ end
139
+
135
140
  def latency
136
141
  entry = Sidekiq.redis do |conn|
137
142
  conn.lrange(@rname, -1, -1)
@@ -4,6 +4,7 @@ require 'yaml'
4
4
  require 'singleton'
5
5
  require 'optparse'
6
6
  require 'erb'
7
+ require 'fileutils'
7
8
 
8
9
  require 'sidekiq'
9
10
  require 'sidekiq/util'
@@ -319,12 +320,10 @@ module Sidekiq
319
320
 
320
321
  def write_pid
321
322
  if path = options[:pidfile]
322
- File.open(path, 'w') do |f|
323
+ pidfile = File.expand_path(path)
324
+ File.open(pidfile, 'w') do |f|
323
325
  f.puts Process.pid
324
326
  end
325
- at_exit do
326
- FileUtils.rm_f path
327
- end
328
327
  end
329
328
  end
330
329
 
@@ -1,4 +1,5 @@
1
1
  require 'sidekiq'
2
+ require 'sidekiq/util'
2
3
  require 'sidekiq/actor'
3
4
 
4
5
  module Sidekiq
@@ -85,6 +85,9 @@ module Sidekiq
85
85
  end
86
86
  end
87
87
  nr
88
+ rescue RuntimeError => ex
89
+ # RuntimeError: ObjectSpace is disabled; each_object will only work with Class, pass -X+O to enable
90
+ puts "Unable to reopen logs: #{ex.message}"
88
91
  end
89
92
 
90
93
  def logger
@@ -133,9 +133,12 @@ module Sidekiq
133
133
  end
134
134
 
135
135
  def heartbeat(key, data)
136
- return if stopped?
136
+ proctitle = ['sidekiq', Sidekiq::VERSION]
137
+ proctitle << data['tag'] unless data['tag'].empty?
138
+ proctitle << "[#{@busy.size} of #{data['concurrency']} busy]"
139
+ proctitle << 'stopping' if stopped?
140
+ $0 = proctitle.join(' ')
137
141
 
138
- $0 = "sidekiq #{Sidekiq::VERSION} #{data['tag']}[#{@busy.size} of #{data['concurrency']} busy]#{stopped? ? ' stopping' : ''}"
139
142
  ❤(key)
140
143
  after(5) do
141
144
  heartbeat(key, data)
@@ -5,7 +5,7 @@ module Sidekiq
5
5
  def call(*args)
6
6
  yield
7
7
  ensure
8
- ::ActiveRecord::Base.clear_active_connections! if defined?(::ActiveRecord)
8
+ ::ActiveRecord::Base.clear_active_connections!
9
9
  end
10
10
  end
11
11
  end
@@ -118,10 +118,10 @@ module Sidekiq
118
118
  worker.sidekiq_retries_exhausted_block.call(msg)
119
119
  end
120
120
  rescue => e
121
- handle_exception(e, { :context => "Error calling retries_exhausted" })
121
+ handle_exception(e, { :context => "Error calling retries_exhausted for #{worker.class}", :job => msg })
122
122
  end
123
123
 
124
- send_to_morgue(msg)
124
+ send_to_morgue(msg) unless msg['dead'] == false
125
125
  end
126
126
 
127
127
  def send_to_morgue(msg)
@@ -1,7 +1,6 @@
1
1
  require 'sidekiq/util'
2
2
  require 'sidekiq/actor'
3
3
 
4
- require 'sidekiq/middleware/server/active_record'
5
4
  require 'sidekiq/middleware/server/retry_jobs'
6
5
  require 'sidekiq/middleware/server/logging'
7
6
 
@@ -22,7 +21,10 @@ module Sidekiq
22
21
  Middleware::Chain.new do |m|
23
22
  m.add Middleware::Server::Logging
24
23
  m.add Middleware::Server::RetryJobs
25
- m.add Middleware::Server::ActiveRecord
24
+ if defined?(::ActiveRecord::Base)
25
+ require 'sidekiq/middleware/server/active_record'
26
+ m.add Sidekiq::Middleware::Server::ActiveRecord
27
+ end
26
28
  end
27
29
  end
28
30
 
@@ -1,17 +1,15 @@
1
1
  module Sidekiq
2
2
  def self.hook_rails!
3
- if defined?(::ActiveRecord)
4
- ::ActiveRecord::Base.__send__(:include, Sidekiq::Extensions::ActiveRecord)
3
+ ActiveSupport.on_load(:active_record) do
4
+ include Sidekiq::Extensions::ActiveRecord
5
5
  end
6
6
 
7
- if defined?(::ActionMailer)
8
- ::ActionMailer::Base.extend(Sidekiq::Extensions::ActionMailer)
7
+ ActiveSupport.on_load(:action_mailer) do
8
+ extend Sidekiq::Extensions::ActionMailer
9
9
  end
10
10
  end
11
11
 
12
12
  class Rails < ::Rails::Engine
13
- config.autoload_paths << File.expand_path("#{config.root}/app/workers") if File.exist?("#{config.root}/app/workers")
14
-
15
13
  initializer 'sidekiq' do
16
14
  Sidekiq.hook_rails!
17
15
  end
@@ -1,4 +1,5 @@
1
1
  require 'securerandom'
2
+ require 'sidekiq'
2
3
 
3
4
  module Sidekiq
4
5
 
@@ -1,3 +1,3 @@
1
1
  module Sidekiq
2
- VERSION = "3.0.0"
2
+ VERSION = "3.0.1"
3
3
  end
@@ -51,6 +51,7 @@ module Sidekiq
51
51
  halt 404 unless params[:name]
52
52
  @count = (params[:count] || 25).to_i
53
53
  @name = params[:name]
54
+ @queue = Sidekiq::Queue.new(@name)
54
55
  (@current_page, @total_size, @messages) = page("queue:#{@name}", params[:page], @count)
55
56
  @messages = @messages.map {|msg| Sidekiq.load_json(msg) }
56
57
  erb :queue
@@ -7,7 +7,10 @@ Gem::Specification.new do |gem|
7
7
  gem.description = gem.summary = "Simple, efficient background processing for Ruby"
8
8
  gem.homepage = "http://sidekiq.org"
9
9
  gem.license = "LGPL-3.0"
10
-
10
+
11
+ # Sidekiq 3 requires ruby 2.0.x
12
+ gem.required_ruby_version = '~> 2.0'
13
+
11
14
  gem.executables = ['sidekiq', 'sidekiqctl']
12
15
  gem.files = `git ls-files | grep -Ev '^(myapp|examples)'`.split("\n")
13
16
  gem.test_files = `git ls-files -- test/*`.split("\n")
@@ -4,6 +4,10 @@ require 'sidekiq/manager'
4
4
  class TestManager < Sidekiq::Test
5
5
 
6
6
  describe 'manager' do
7
+ before do
8
+ Sidekiq.redis {|c| c.flushdb }
9
+ end
10
+
7
11
  it 'creates N processor instances' do
8
12
  mgr = Sidekiq::Manager.new(options)
9
13
  assert_equal options[:concurrency], mgr.ready.size
@@ -77,9 +81,75 @@ class TestManager < Sidekiq::Test
77
81
  fetcher.verify
78
82
  end
79
83
 
84
+ describe 'heartbeat' do
85
+ before do
86
+ uow = Object.new
87
+
88
+ @processor = Minitest::Mock.new
89
+ @processor.expect(:async, @processor, [])
90
+ @processor.expect(:process, nil, [uow])
91
+
92
+ @mgr = Sidekiq::Manager.new(options)
93
+ @mgr.ready << @processor
94
+ @mgr.assign(uow)
95
+
96
+ @processor.verify
97
+ @proctitle = $0
98
+ end
99
+
100
+ after do
101
+ $0 = @proctitle
102
+ end
103
+
104
+ describe 'when manager is active' do
105
+ before do
106
+ @mgr.heartbeat('identity', heartbeat_data)
107
+ end
108
+
109
+ it 'sets useful info to proctitle' do
110
+ assert_equal "sidekiq #{Sidekiq::VERSION} myapp [1 of 3 busy]", $0
111
+ end
112
+
113
+ it 'stores process info in redis' do
114
+ info = Sidekiq.redis { |c| c.hmget('identity', 'busy') }
115
+ assert_equal ["1"], info
116
+ expires = Sidekiq.redis { |c| c.pttl('identity') }
117
+ assert_in_delta 60000, expires, 1
118
+ end
119
+ end
120
+
121
+ describe 'when manager is stopped' do
122
+ before do
123
+ @processor.expect(:alive?, [])
124
+ @processor.expect(:terminate, [])
125
+
126
+ @mgr.stop
127
+ @mgr.processor_done(@processor)
128
+ @mgr.heartbeat('identity', heartbeat_data)
129
+
130
+ @processor.verify
131
+ end
132
+
133
+ it 'indicates status in proctitle' do
134
+ assert_equal "sidekiq #{Sidekiq::VERSION} myapp [0 of 3 busy] stopping", $0
135
+ end
136
+
137
+ it 'stores process info in redis' do
138
+ info = Sidekiq.redis { |c| c.hmget('identity', 'busy') }
139
+ assert_equal ["0"], info
140
+ expires = Sidekiq.redis { |c| c.pttl('identity') }
141
+ assert_in_delta 60000, expires, 1
142
+ end
143
+ end
144
+ end
145
+
80
146
  def options
81
147
  { :concurrency => 3, :queues => ['default'] }
82
148
  end
149
+
150
+ def heartbeat_data
151
+ { 'concurrency' => 3, 'tag' => 'myapp' }
152
+ end
83
153
  end
84
154
 
85
155
  end
@@ -197,6 +197,18 @@ td form {
197
197
  padding: 0px;
198
198
  }
199
199
 
200
+ .table td {
201
+ /* Non standard for webkit */
202
+ word-break: break-word;
203
+
204
+ -webkit-hyphens: auto;
205
+ -moz-hyphens: auto;
206
+ hyphens: auto;
207
+
208
+ -ms-word-break: break-all;
209
+ word-break: break-all;
210
+ }
211
+
200
212
  table .table-checkbox label {
201
213
  height: 100%;
202
214
  width: 100%;
@@ -66,3 +66,4 @@ en: # <---- change this to your locale code
66
66
  Thread: Thread
67
67
  Threads: Threads
68
68
  Jobs: Jobs
69
+ Paused: Paused
@@ -13,9 +13,9 @@ fr:
13
13
  Retries: Tentatives
14
14
  Enqueued: En queue
15
15
  Worker: Travailleur
16
- LivePoll: Live polling
17
- StopPolling: Arrêt du polling
18
- Queue: File
16
+ LivePoll: Temps réel
17
+ StopPolling: Arrêt du temps réel
18
+ Queue: Queue
19
19
  Class: Classe
20
20
  Job: Tâche
21
21
  Arguments: Arguments
@@ -44,9 +44,9 @@ ja:
44
44
  ErrorMessage: エラーメッセージ
45
45
  ErrorBacktrace: エラーバックトレース
46
46
  GoBack: ← 戻る
47
- NoScheduledFound: 予定された作業はありません
47
+ NoScheduledFound: 予定したジョブはありません
48
48
  When: いつ
49
- ScheduledJobs: 予定された作業
49
+ ScheduledJobs: 予定したジョブ
50
50
  idle: アイドル
51
51
  active: アクティブ
52
52
  Version: バージョン
@@ -60,9 +60,9 @@ ja:
60
60
  SixMonths: 6 ヶ月
61
61
  Batches: バッチ
62
62
  Failures: 失敗
63
- DeadJobs: 死んだジョブ
64
- NoDeadJobsFound: 死んだジョブはありません
65
- Dead: 死んだ
63
+ DeadJobs: 死亡したジョブ
64
+ NoDeadJobsFound: 死亡したジョブはありません
65
+ Dead: 死亡
66
66
  Processes: プロセス
67
67
  Thread: スレッド
68
68
  Threads: スレッド
@@ -6,7 +6,7 @@ ko:
6
6
  Namespace: 네임스페이스
7
7
  Realtime: 실시간
8
8
  History: 히스토리
9
- Busy: 바쁨
9
+ Busy: 작동
10
10
  Processed: 처리완료
11
11
  Failed: 실패
12
12
  Scheduled: 예약
@@ -59,3 +59,10 @@ ko:
59
59
  SixMonths: 6 달
60
60
  Batches: 배치
61
61
  Failures: 실패
62
+ DeadJobs: 죽은 작업
63
+ NoDeadJobsFound: 죽은 작업이 없습니다
64
+ Dead: 죽음
65
+ Processes: 프로세스
66
+ Thread: 스레드
67
+ Threads: 스레드
68
+ Jobs: 작업
@@ -2,6 +2,9 @@
2
2
  <div class="col-sm-5">
3
3
  <h3>
4
4
  <%= t('CurrentMessagesInQueue', :queue => @name) %>
5
+ <% if @queue.paused? %>
6
+ <span class="label label-danger"><%= t('Paused') %></span>
7
+ <% end %>
5
8
  </h3>
6
9
  </div>
7
10
  <div class="col-sm-4 pull-right">
@@ -10,6 +10,9 @@
10
10
  <tr>
11
11
  <td>
12
12
  <a href="<%= root_path %>queues/<%= queue.name %>"><%= queue.name %></a>
13
+ <% if queue.paused? %>
14
+ <span class="label label-danger"><%= t('Paused') %></span>
15
+ <% end %>
13
16
  </td>
14
17
  <td><%= number_with_delimiter(queue.size) %> </td>
15
18
  <td width="20%">
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: 3.0.0
4
+ version: 3.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Perham
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-28 00:00:00.000000000 Z
11
+ date: 2014-05-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redis
@@ -328,9 +328,9 @@ require_paths:
328
328
  - lib
329
329
  required_ruby_version: !ruby/object:Gem::Requirement
330
330
  requirements:
331
- - - ">="
331
+ - - "~>"
332
332
  - !ruby/object:Gem::Version
333
- version: '0'
333
+ version: '2.0'
334
334
  required_rubygems_version: !ruby/object:Gem::Requirement
335
335
  requirements:
336
336
  - - ">="