Possible fix

pull/1214/head
Rick Carlino 2019-05-29 11:55:27 -05:00
parent 8b6c8fe004
commit 5c854520d6
1 changed files with 6 additions and 4 deletions

View File

@ -28,10 +28,12 @@ module Resources
def self.step1(delivery_info, body) # Returns params or nil
Preprocessor.from_amqp(delivery_info, body)
rescue Mutations::ValidationException => q
x = delivery_info.to_hash.slice(:consumer_tag,
:redelivered,
:exchange,
:routing_key).merge(body: body)
# AUTHORS NOTE: Some of the Bunny data structures have circular
# references that will cause the JSON serializer
# to crash. the safe_attrs var reduces the risk of
# stack overflow during serialization.
safe_attrs = [:consumer_tag, :redelivered, :exchange, :routing_key]
x = delivery_info.to_hash.slice(*safe_attrs).merge(body: body)
Rollbar.error(q, x)
raw_chan = delivery_info&.routing_key&.split(".") || []
id = raw_chan[INDEX_OF_USERNAME]&.gsub("device_", "")&.to_i