Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Truncate error message to 10k, #1843

  • Loading branch information...
commit 840c8f6e1622ae3a8236fcc34b0f102c15b60b11 1 parent be439c5
Mike Perham authored
5 Changes.md
View
@@ -1,8 +1,3 @@
-Master
-------
-
-- Add ability to truncate error messages with the `error_message_limit` option.
-
3.2.1
-----------
4 lib/sidekiq/middleware/server/retry_jobs.rb
View
@@ -50,8 +50,6 @@ module Server
# end
# end
#
- # The error message may be truncated to a maximum size by specifying an
- # `error_message_limit` in a worker's `sidekiq_options` or globally.
class RetryJobs
include Sidekiq::Util
@@ -78,7 +76,7 @@ def call(worker, msg, queue)
else
queue
end
- msg['error_message'] = e.message[0..(msg['error_message_limit'].to_i - 1)]
+ msg['error_message'] = e.message[0..10_000]
msg['error_class'] = e.class.name
count = if msg['retry_count']
msg['retried_at'] = Time.now.to_f
18 test/test_retry.rb
View
@@ -259,24 +259,6 @@ def @redis.multi; yield self; end
@redis.verify
end
- it 'truncates the error_message down to the user-specified limit' do
- @redis.expect :zadd, 1, ['retry', String, String]
- msg = { 'class' => 'Bob', 'args' => [1,2,'foo'], 'retry' => true, 'error_message_limit' => 10 }
- handler = Sidekiq::Middleware::Server::RetryJobs.new
- assert_raises RuntimeError do
- handler.call(worker, msg, 'default') do
- raise "kerblammo! (Truncate this part, please.)"
- end
- end
- assert_equal 'default', msg["queue"]
- assert_equal 'kerblammo!', msg["error_message"]
- assert_equal 'RuntimeError', msg["error_class"]
- assert_equal 0, msg["retry_count"]
- refute msg["error_backtrace"]
- assert msg["failed_at"]
- @redis.verify
- end
-
describe "custom retry delay" do
before do
@old_logger = Sidekiq.logger

1 comment on commit 840c8f6

Michael Gee

Thanks @mperham. Works for me.

Please sign in to comment.
Something went wrong with that request. Please try again.