From 1f38ae934dff47f0bcec89b386d0b882b66e7692 Mon Sep 17 00:00:00 2001 From: Viktor Vsk Date: Wed, 22 Nov 2023 10:18:27 +0100 Subject: [PATCH] Avoid long-running REQ commands by setting a statement_timeout on pg side --- app/jobs/new_subscription.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/jobs/new_subscription.rb b/app/jobs/new_subscription.rb index 1537886..efbce8b 100644 --- a/app/jobs/new_subscription.rb +++ b/app/jobs/new_subscription.rb @@ -35,5 +35,7 @@ def perform(connection_id, subscription_id, filters) MemStore.fanout(cid: connection_id, sid: subscription_id, command: :found_end, payload: "EOSE") ReqFiltersLog.create(filters: filters) if SHOULD_LOG_FILTERS + rescue ActiveRecord::QueryCanceled + MemStore.fanout(cid: connection_id, command: :notice, payload: "#{subscription_id} subscription timeout, please try to make a simpler query") end end