From ecd3942c89efcfdb6a154e2d327c7b6e425c167a Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Tue, 30 Jan 2024 14:55:47 -0500 Subject: [PATCH] Don't crash if a single poll for notify fails --- sgx_jmp.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sgx_jmp.rb b/sgx_jmp.rb index 2174ababd8c6a4f98688adf5214b3a2bbbc3a1c0..6fdf2fe3f575d688e9e3527cf6147508e1a60731 100644 --- a/sgx_jmp.rb +++ b/sgx_jmp.rb @@ -185,9 +185,10 @@ def poll_for_notify(db) repo.find(notify[:extra]).then do |customer| DbNotification.for(notify, customer, repo) end - }.then(&:call).then { - EM.add_timer(0.5) { poll_for_notify(db) } - }.catch(&method(:panic)) + }.then(&:call).catch { |e| + log.fatal("Error during poll_for_notify", e) + Sentry.capture_exception(e) + }.then { EM.add_timer(0.5) { poll_for_notify(db) } } end def load_plans_to_db!