Report cache diff to Bugsnag in a new tab

This will allow us to see the difference between the cache entry and the
actual shopfront. Otherwise, there is no way to see what wasn't
refreshed in the cache.
This commit is contained in:
Pau Perez
2019-05-10 00:06:01 +02:00
committed by luisramos0
parent f951ebe178
commit bb12592a74

View File

@@ -3,7 +3,14 @@ require 'open_food_network/products_cache_integrity_checker'
ProductsCacheIntegrityCheckerJob = Struct.new(:distributor_id, :order_cycle_id) do
def perform
unless checker.ok?
Bugsnag.notify RuntimeError.new("Products JSON differs from cached version for distributor: #{distributor_id}, order cycle: #{order_cycle_id}"), diff: checker.diff.to_s(:text)
exception = RuntimeError.new(
"Products JSON differs from cached version for distributor: #{distributor_id}, " \
"order cycle: #{order_cycle_id}"
)
Bugsnag.notify(exception) do |report|
report.add_tab(:products_cache, diff: checker.diff.to_s(:text))
end
end
end