summaryrefslogtreecommitdiff
path: root/Omni/Agent/Telegram/IncomingQueue.hs
diff options
context:
space:
mode:
authorBen Sima <ben@bensima.com>2025-12-26 09:48:38 -0500
committerBen Sima <ben@bensima.com>2025-12-26 09:48:38 -0500
commit7c63dca29cfe6c2e402d917efedfb426fb3b8fe6 (patch)
treed16f5d1bcafe4dd0ba3f824c0d60507756eccf88 /Omni/Agent/Telegram/IncomingQueue.hs
parenta4108a484a1c5e83f926b84899fe228d59e5ea18 (diff)
Omni/Agent/Telegram/IncomingQueue: add error handling to batcher
Wrap processFn in try/catch so exceptions don't kill the batcher thread. Previously, if a message handler threw an exception, the batcher would die and subsequent messages would be received but not processed. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Diffstat (limited to 'Omni/Agent/Telegram/IncomingQueue.hs')
-rw-r--r--Omni/Agent/Telegram/IncomingQueue.hs5
1 files changed, 4 insertions, 1 deletions
diff --git a/Omni/Agent/Telegram/IncomingQueue.hs b/Omni/Agent/Telegram/IncomingQueue.hs
index 875fbf3..60864ed 100644
--- a/Omni/Agent/Telegram/IncomingQueue.hs
+++ b/Omni/Agent/Telegram/IncomingQueue.hs
@@ -178,7 +178,10 @@ startIncomingBatcher queuesVar processFn =
(firstQm : _) -> do
let baseMsg = qmMsg firstQm
batchedTxt = formatBatch qmsgs
- processFn baseMsg batchedTxt
+ result <- try @SomeException (processFn baseMsg batchedTxt)
+ case result of
+ Left err -> putText <| "Batcher error processing message: " <> tshow err
+ Right () -> pure ()
threadDelay 200000
formatBatch :: [QueuedMsg] -> Text