Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'master' into 3-0

  • Loading branch information...
commit 2e1ffbc82bb0d8f491ddfa3bf23efffe6740ec01 2 parents d355a04 + 10bccba
Mike Perham authored
1  Changes.md
View
@@ -19,6 +19,7 @@
2.17.5
-----------
+- Store 'retried\_at' and 'failed\_at' timestamps as Floats, not Strings. [#1473]
- A `USR2` signal will now reopen _all_ logs, using IO#reopen. Thus, instead of creating a new Logger object,
Sidekiq will now just update the existing Logger's file descriptor [#1163].
- Remove pidfile when shutting down if started with `-P` [#1470]
2  config.ru
View
@@ -12,7 +12,7 @@ end
#Sidekiq.redis { |conn| conn.zadd('retry', Time.now.utc.to_f + 3000, MultiJson.encode({
#'class' => 'HardWorker', 'args' => ['foo', 0.1, Time.now.to_f],
#'queue' => 'default', 'error_message' => 'No such method', 'error_class' => 'NoMethodError',
- #'failed_at' => Time.now.utc, 'retry_count' => 0 })) }
+ #'failed_at' => Time.now.to_i, 'retry_count' => 0 })) }
require 'sidekiq/web'
run Sidekiq::Web
4 lib/sidekiq/middleware/server/retry_jobs.rb
View
@@ -75,10 +75,10 @@ def call(worker, msg, queue)
msg['error_message'] = e.message
msg['error_class'] = e.class.name
count = if msg['retry_count']
- msg['retried_at'] = Time.now.utc
+ msg['retried_at'] = Time.now.to_f
msg['retry_count'] += 1
else
- msg['failed_at'] = Time.now.utc
+ msg['failed_at'] = Time.now.to_f
msg['retry_count'] = 0
end
2  test/test_api.rb
View
@@ -380,7 +380,7 @@ class ApiWorker
end
def add_retry(jid = 'bob', at = Time.now.to_f)
- payload = Sidekiq.dump_json('class' => 'ApiWorker', 'args' => [1, 'mike'], 'queue' => 'default', 'jid' => jid, 'retry_count' => 2, 'failed_at' => Time.now.utc)
+ payload = Sidekiq.dump_json('class' => 'ApiWorker', 'args' => [1, 'mike'], 'queue' => 'default', 'jid' => jid, 'retry_count' => 2, 'failed_at' => Time.now.to_f)
Sidekiq.redis do |conn|
conn.zadd('retry', at.to_s, payload)
end
10 test/test_retry.rb
View
@@ -129,7 +129,7 @@ def @redis.with; yield self; end
it 'handles a recurring failed message' do
@redis.expect :zadd, 1, ['retry', String, String]
- now = Time.now.utc
+ now = Time.now.to_f
msg = {"class"=>"Bob", "args"=>[1, 2, "foo"], 'retry' => true, "queue"=>"default", "error_message"=>"kerblammo!", "error_class"=>"RuntimeError", "failed_at"=>now, "retry_count"=>10}
handler = Sidekiq::Middleware::Server::RetryJobs.new
assert_raises RuntimeError do
@@ -147,7 +147,7 @@ def @redis.with; yield self; end
it 'handles a recurring failed message before reaching user-specifed max' do
@redis.expect :zadd, 1, ['retry', String, String]
- now = Time.now.utc
+ now = Time.now.to_f
msg = {"class"=>"Bob", "args"=>[1, 2, "foo"], 'retry' => 10, "queue"=>"default", "error_message"=>"kerblammo!", "error_class"=>"RuntimeError", "failed_at"=>now, "retry_count"=>8}
handler = Sidekiq::Middleware::Server::RetryJobs.new
assert_raises RuntimeError do
@@ -164,7 +164,7 @@ def @redis.with; yield self; end
end
it 'throws away old messages after too many retries (using the default)' do
- now = Time.now.utc
+ now = Time.now.to_f
msg = {"class"=>"Bob", "args"=>[1, 2, "foo"], "queue"=>"default", "error_message"=>"kerblammo!", "error_class"=>"RuntimeError", "failed_at"=>now, "retry"=>true, "retry_count"=>25}
@redis.expect :zadd, 1, [ 'retry', String, String ]
handler = Sidekiq::Middleware::Server::RetryJobs.new
@@ -178,7 +178,7 @@ def @redis.with; yield self; end
end
it 'throws away old messages after too many retries (using user-specified max)' do
- now = Time.now.utc
+ now = Time.now.to_f
msg = {"class"=>"Bob", "args"=>[1, 2, "foo"], "queue"=>"default", "error_message"=>"kerblammo!", "error_class"=>"RuntimeError", "failed_at"=>now, "retry"=>3, "retry_count"=>3}
@redis.expect :zadd, 1, [ 'retry', String, String ]
handler = Sidekiq::Middleware::Server::RetryJobs.new
@@ -194,7 +194,7 @@ def @redis.with; yield self; end
describe "retry exhaustion" do
let(:handler){ Sidekiq::Middleware::Server::RetryJobs.new }
let(:worker) { Minitest::Mock.new }
- let(:msg){ {"class"=>"Bob", "args"=>[1, 2, "foo"], "queue"=>"default", "error_message"=>"kerblammo!", "error_class"=>"RuntimeError", "failed_at"=>Time.now.utc, "retry"=>3, "retry_count"=>3} }
+ let(:msg){ {"class"=>"Bob", "args"=>[1, 2, "foo"], "queue"=>"default", "error_message"=>"kerblammo!", "error_class"=>"RuntimeError", "failed_at"=>Time.now.to_f, "retry"=>3, "retry_count"=>3} }
describe "worker block" do
let(:worker) do
4 test/test_web.rb
View
@@ -423,7 +423,7 @@ def add_retry
'error_message' => 'Some fake message',
'error_class' => 'RuntimeError',
'retry_count' => 0,
- 'failed_at' => Time.now.utc,
+ 'failed_at' => Time.now.to_f,
'jid' => SecureRandom.hex(12) }
score = Time.now.to_f
Sidekiq.redis do |conn|
@@ -455,7 +455,7 @@ def add_xss_retry
'error_message' => 'fail message: <a>hello</a>',
'error_class' => 'RuntimeError',
'retry_count' => 0,
- 'failed_at' => Time.now.utc,
+ 'failed_at' => Time.now.to_f,
'jid' => SecureRandom.hex(12) }
score = Time.now.to_f
Sidekiq.redis do |conn|
2  web/locales/fr.yml
View
@@ -2,7 +2,7 @@
fr:
Dashboard: Tableau de Bord
Status: État
- Time: Temps
+ Time: Heure
Namespace: Namespace
Realtime: Temps Réel
History: Historique
Please sign in to comment.
Something went wrong with that request. Please try again.