Browse Source

Gracefully handle check deletion

Andrew Kane 6 years ago
parent
commit
5beb09e9ef
1 changed files with 8 additions and 2 deletions
  1. 8 2
      lib/blazer.rb

+ 8 - 2
lib/blazer.rb

@@ -130,8 +130,14 @@ module Blazer
           break
         end
       end
-      check.reload # in case state has changed since job started
-      check.update_state(result)
+
+      begin
+        check.reload # in case state has changed since job started
+        check.update_state(result)
+      rescue ActiveRecord::RecordNotFound
+        # check deleted
+      end
+
       # TODO use proper logfmt
       Rails.logger.info "[blazer check] query=#{check.query.name} state=#{check.state} rows=#{result.rows.try(:size)} error=#{result.error}"