sidekiq 2.10.1 → 2.11.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.

data/Changes.md CHANGED
@@ -1,3 +1,13 @@
1
+ 2.11.0
2
+ -----------
3
+
4
+ - Upgrade to Celluloid 0.13. [#834]
5
+ - Remove **timeout** support from `sidekiq_options`. Ruby's timeout
6
+ is inherently unsafe in a multi-threaded application and was causing
7
+ stability problems for many. See http://bit.ly/OtYpK
8
+ - Add Japanese locale for Web UI [#868]
9
+ - Fix a few issues with Web UI i18n.
10
+
1
11
  2.10.1
2
12
  -----------
3
13
 
data/Gemfile CHANGED
@@ -1,7 +1,7 @@
1
1
  source 'http://rubygems.org'
2
2
  gemspec
3
3
 
4
- gem 'celluloid', "~> 0.12.0"
4
+ gem 'celluloid', "~> 0.13.0"
5
5
  gem 'slim'
6
6
  gem 'sqlite3', :platform => :mri
7
7
 
@@ -7,11 +7,6 @@ require 'sidekiq/redis_connection'
7
7
  require 'sidekiq/util'
8
8
  require 'sidekiq/api'
9
9
 
10
- require 'sidekiq/extensions/class_methods'
11
- require 'sidekiq/extensions/action_mailer'
12
- require 'sidekiq/extensions/active_record'
13
- require 'sidekiq/rails' if defined?(::Rails::Engine)
14
-
15
10
  require 'multi_json'
16
11
 
17
12
  module Sidekiq
@@ -43,7 +38,7 @@ module Sidekiq
43
38
  # Configuration for Sidekiq server, use like:
44
39
  #
45
40
  # Sidekiq.configure_server do |config|
46
- # config.redis = { :namespace => 'myapp', :size => 25, :url => 'redis://myhost:8877/mydb' }
41
+ # config.redis = { :namespace => 'myapp', :size => 25, :url => 'redis://myhost:8877/0' }
47
42
  # config.server_middleware do |chain|
48
43
  # chain.add MyServerHook
49
44
  # end
@@ -56,7 +51,7 @@ module Sidekiq
56
51
  # Configuration for Sidekiq client, use like:
57
52
  #
58
53
  # Sidekiq.configure_client do |config|
59
- # config.redis = { :namespace => 'myapp', :size => 1, :url => 'redis://myhost:8877/mydb' }
54
+ # config.redis = { :namespace => 'myapp', :size => 1, :url => 'redis://myhost:8877/0' }
60
55
  # end
61
56
  def self.configure_client
62
57
  yield self unless server?
@@ -115,3 +110,9 @@ module Sidekiq
115
110
  end
116
111
 
117
112
  end
113
+
114
+ require 'sidekiq/extensions/class_methods'
115
+ require 'sidekiq/extensions/action_mailer'
116
+ require 'sidekiq/extensions/active_record'
117
+ require 'sidekiq/rails' if defined?(::Rails::Engine)
118
+
@@ -127,7 +127,7 @@ module Sidekiq
127
127
  # Celluloid can't be loaded until after we've daemonized
128
128
  # because it spins up threads and creates locks which get
129
129
  # into a very bad state if forked.
130
- require 'celluloid'
130
+ require 'celluloid/autostart'
131
131
  Celluloid.logger = (options[:verbose] ? Sidekiq.logger : nil)
132
132
 
133
133
  require 'sidekiq/manager'
@@ -11,9 +11,6 @@ module Sidekiq
11
11
  # UserMailer.delay_until(5.days.from_now).send_welcome_email(new_user)
12
12
  class DelayedMailer
13
13
  include Sidekiq::Worker
14
- # I think it's reasonable to assume that emails should take less
15
- # than 30 seconds to send.
16
- sidekiq_options :timeout => 30
17
14
 
18
15
  def perform(yml)
19
16
  (target, method_name, args) = YAML.load(yml)
@@ -69,6 +69,8 @@ module Sidekiq
69
69
 
70
70
  if msg['backtrace'] == true
71
71
  msg['error_backtrace'] = e.backtrace
72
+ elsif msg['backtrace'] == false
73
+ # do nothing
72
74
  elsif msg['backtrace'].to_i != 0
73
75
  msg['error_backtrace'] = e.backtrace[0..msg['backtrace'].to_i]
74
76
  end
@@ -4,7 +4,6 @@ require 'sidekiq/util'
4
4
  require 'sidekiq/middleware/server/active_record'
5
5
  require 'sidekiq/middleware/server/retry_jobs'
6
6
  require 'sidekiq/middleware/server/logging'
7
- require 'sidekiq/middleware/server/timeout'
8
7
 
9
8
  module Sidekiq
10
9
  ##
@@ -20,7 +19,6 @@ module Sidekiq
20
19
  m.add Middleware::Server::Logging
21
20
  m.add Middleware::Server::RetryJobs
22
21
  m.add Middleware::Server::ActiveRecord
23
- m.add Middleware::Server::Timeout
24
22
  end
25
23
  end
26
24
 
@@ -1,3 +1,3 @@
1
1
  module Sidekiq
2
- VERSION = "2.10.1"
2
+ VERSION = "2.11.0"
3
3
  end
@@ -28,7 +28,7 @@ module Sidekiq
28
28
  end
29
29
 
30
30
  def t(msg, options={})
31
- string = strings[get_locale].fetch(msg) || strings['en'].fetch(msg)
31
+ string = strings[get_locale] ? strings[get_locale].fetch(msg) : strings['en'].fetch(msg)
32
32
  string % options
33
33
  end
34
34
 
@@ -51,11 +51,11 @@ module Sidekiq
51
51
  #
52
52
  # :queue - use a named queue for this Worker, default 'default'
53
53
  # :retry - enable the RetryJobs middleware for this Worker, default *true*
54
- # :timeout - timeout the perform method after N seconds, default *nil*
55
54
  # :backtrace - whether to save any error backtrace in the retry payload to display in web UI,
56
55
  # can be true, false or an integer number of lines to save, default *false*
57
56
  def sidekiq_options(opts={})
58
57
  self.sidekiq_options_hash = get_sidekiq_options.merge((opts || {}).stringify_keys)
58
+ ::Sidekiq.logger.warn("#{self.name} - :timeout is unsafe and support has been removed from Sidekiq, see http://bit.ly/OtYpK for details")
59
59
  end
60
60
 
61
61
  DEFAULT_OPTIONS = { 'retry' => true, 'queue' => 'default' }
@@ -17,7 +17,7 @@ Gem::Specification.new do |gem|
17
17
  gem.add_dependency 'redis', '~> 3'
18
18
  gem.add_dependency 'redis-namespace'
19
19
  gem.add_dependency 'connection_pool', '~> 1.0'
20
- gem.add_dependency 'celluloid', '~> 0.12.0'
20
+ gem.add_dependency 'celluloid', '~> 0.13.0'
21
21
  gem.add_dependency 'multi_json', '~> 1'
22
22
  gem.add_development_dependency 'sinatra'
23
23
  gem.add_development_dependency 'slim'
@@ -99,7 +99,7 @@ class TestClient < MiniTest::Unit::TestCase
99
99
 
100
100
  class QueuedWorker
101
101
  include Sidekiq::Worker
102
- sidekiq_options :queue => :flimflam, :timeout => 1
102
+ sidekiq_options :queue => :flimflam
103
103
  end
104
104
 
105
105
  it 'enqueues to the named queue' do
@@ -29,9 +29,19 @@ class TestWeb < MiniTest::Unit::TestCase
29
29
  end
30
30
 
31
31
  it 'can display workers' do
32
+ Sidekiq.redis do |conn|
33
+ identity = 'foo:1234-123abc:default'
34
+ conn.sadd('workers', identity)
35
+ conn.setex("worker:#{identity}:started", 10, Time.now.to_s)
36
+ hash = {:queue => 'critical', :payload => { 'class' => WebWorker.name, 'args' => [1,'abc'] }, :run_at => Time.now.to_i }
37
+ conn.setex("worker:#{identity}", 10, Sidekiq.dump_json(hash))
38
+ end
39
+
32
40
  get '/workers'
33
41
  assert_equal 200, last_response.status
34
- assert_match /status-idle/, last_response.body
42
+ assert_match /status-active/, last_response.body
43
+ assert_match /critical/, last_response.body
44
+ assert_match /WebWorker/, last_response.body
35
45
  end
36
46
 
37
47
  it 'can display queues' do
@@ -0,0 +1,62 @@
1
+ # elements like %{queue} are variables and should not be translated
2
+ ja:
3
+ Dashboard: ダッシュボード
4
+ Status: ステータス
5
+ Time: 時間
6
+ Namespace: ネームスペース
7
+ Realtime: リアルタイム
8
+ History: 履歴
9
+ Busy: ビジー
10
+ Processed: 処理完了
11
+ Failed: 失敗
12
+ Scheduled: 予定
13
+ Retries: 再試行
14
+ Enqueued: 待機状態
15
+ ClearWorkerList: 動作中の作業を停止
16
+ Worker: 動作中の作業
17
+ Workers: 動作中の作業
18
+ LivePoll: 転送中
19
+ StopPolling: 転送停止
20
+ Queue: キュー
21
+ Class: クラス
22
+ Job: ジョブ
23
+ Arguments: 引数
24
+ Started: 開始
25
+ ShowAll: 全て見せる
26
+ CurrentMessagesInQueue: <span class='title'>%{queue}</span>に メッセージがあります
27
+ Delete: 削除
28
+ AreYouSureDeleteJob: 本当にこの作業を削除しますか?
29
+ AreYouSureDeleteQueue: 本当に %{queue} キュー 削除しますか?
30
+ Queues: キュー
31
+ Size: サイズ
32
+ Actions: アクション
33
+ NextRetry: 再試行
34
+ RetryCount: 再試行
35
+ RetryNow: 今すぐ再試行
36
+ LastRetry: 再試行履歴
37
+ OriginallyFailed: 失敗
38
+ AreYouSure: 本当にいいですか?
39
+ DeleteAll: 全て削除
40
+ RetryAll: 全て再試行
41
+ NoRetriesFound: 再試行できません
42
+ Error: エラー
43
+ ErrorClass: クラスエラー
44
+ ErrorMessage: エラーメッセージ
45
+ ErrorBacktrace: エラーバックトレース
46
+ GoBack: ← 戻る
47
+ NoScheduledFound: 予定された作業はありません
48
+ When: いつ
49
+ ScheduledJobs: 予定された作業
50
+ idle: アイドル状態
51
+ active: アクティブ
52
+ Version: バージョン
53
+ Connections: 接続
54
+ MemoryUsage: メモリー容量
55
+ PeakMemoryUsage: 最大メモリー容量
56
+ Uptime: Uptime (days)
57
+ OneWeek: 1週
58
+ OneMonth: 1 ヶ月
59
+ ThreeMonths: 3 ヶ月
60
+ SixMonths: 6 ヶ月
61
+ Batches: Batches
62
+ Failures: 失敗
@@ -7,4 +7,4 @@
7
7
  .row
8
8
  .span2.pull-right
9
9
  form action="#{root_path}reset" method="post"
10
- button.btn.btn-primary.btn-block type="submit" title="#{t('Kill9Warning')}" = t('ClearWorkerList')
10
+ button.btn.btn-primary.btn-block type="submit" = t('ClearWorkerList')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sidekiq
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.10.1
4
+ version: 2.11.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-04-18 00:00:00.000000000 Z
12
+ date: 2013-04-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: redis
@@ -66,7 +66,7 @@ dependencies:
66
66
  requirements:
67
67
  - - ~>
68
68
  - !ruby/object:Gem::Version
69
- version: 0.12.0
69
+ version: 0.13.0
70
70
  type: :runtime
71
71
  prerelease: false
72
72
  version_requirements: !ruby/object:Gem::Requirement
@@ -74,7 +74,7 @@ dependencies:
74
74
  requirements:
75
75
  - - ~>
76
76
  - !ruby/object:Gem::Version
77
- version: 0.12.0
77
+ version: 0.13.0
78
78
  - !ruby/object:Gem::Dependency
79
79
  name: multi_json
80
80
  requirement: !ruby/object:Gem::Requirement
@@ -243,7 +243,6 @@ files:
243
243
  - lib/sidekiq/middleware/server/active_record.rb
244
244
  - lib/sidekiq/middleware/server/logging.rb
245
245
  - lib/sidekiq/middleware/server/retry_jobs.rb
246
- - lib/sidekiq/middleware/server/timeout.rb
247
246
  - lib/sidekiq/paginator.rb
248
247
  - lib/sidekiq/processor.rb
249
248
  - lib/sidekiq/rails.rb
@@ -293,6 +292,7 @@ files:
293
292
  - web/locales/es.yml
294
293
  - web/locales/fr.yml
295
294
  - web/locales/it.yml
295
+ - web/locales/ja.yml
296
296
  - web/locales/pl.yml
297
297
  - web/locales/pt-br.yml
298
298
  - web/locales/pt.yml
@@ -1,21 +0,0 @@
1
- require 'timeout'
2
-
3
- module Sidekiq
4
- module Middleware
5
- module Server
6
- class Timeout
7
-
8
- def call(worker, msg, queue)
9
- if msg['timeout'] && msg['timeout'].to_i != 0
10
- ::Timeout.timeout(msg['timeout'].to_i) do
11
- yield
12
- end
13
- else
14
- yield
15
- end
16
- end
17
-
18
- end
19
- end
20
- end
21
- end