From bb12592a746d62a2ea4651b339eee2f512f5993e Mon Sep 17 00:00:00 2001 From: Pau Perez Date: Fri, 10 May 2019 00:06:01 +0200 Subject: [PATCH] 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. --- app/jobs/products_cache_integrity_checker_job.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/jobs/products_cache_integrity_checker_job.rb b/app/jobs/products_cache_integrity_checker_job.rb index 78feb3a1b0..8861b5a5a9 100644 --- a/app/jobs/products_cache_integrity_checker_job.rb +++ b/app/jobs/products_cache_integrity_checker_job.rb @@ -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