Skip to content

Commit

Permalink
Merge pull request #904 from rollbar/wj-skip-payload-config-on-async
Browse files Browse the repository at this point in the history
Skip configured_options when using async payload handlers
  • Loading branch information
waltjones committed Aug 30, 2019
2 parents efcd809 + 121a2ac commit f0e6da7
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/rollbar/item.rb
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,15 @@ def configured_options
# the risk just to send this diagnostic object. In versions < 4.1, ActiveSupport hooks
# Ruby's JSON.generate so deeply there's no workaround.
'not serialized in ActiveSupport < 4.1'
elsif configuration.use_async
# Currently serialization is performed by each handler, and this invariably
# means it is actually performed by ActiveSupport.
#
# TODO: Since serialization must be done prior to scheduling the job,
# it should at least be done by rollbar-gem itself. Much work has been done
# to avoid the bugs in ActiveSupport JSON. The async handlers are currently
# still subject to all those knnown issues.
'not serialized for async/delayed handlers'
else
scrub(configuration.configured_options.configured)
end
Expand Down
15 changes: 15 additions & 0 deletions spec/rollbar_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1401,6 +1401,21 @@ def backtrace
Rollbar.error(exception)
end

# Temporary. See comments at Item#configured_options
it 'should not send configured_options in payload', :if => Gem.loaded_specs['activesupport'].version >= Gem::Version.new('4.1') do
logger_mock.should_receive(:info).with('not serialized for async/delayed handlers')

Rollbar.configure do |config|
config.use_async = true
config.async_handler = proc { |payload|
logger_mock.info payload['data'][:notifier][:configured_options]
Rollbar.process_from_async_handler(payload)
}
end

Rollbar.error(exception)
end

# We should be able to send String payloads, generated
# by a previous version of the gem. This can happend just
# after a deploy with an gem upgrade.
Expand Down

0 comments on commit f0e6da7

Please sign in to comment.