Skip to content

Commit

Permalink
silence default exception handler in pactqueue forked thread
Browse files Browse the repository at this point in the history
Change-Id: I176b803aa6399e0df8c39d5d6d9eecbce238dcb5
  • Loading branch information
chessai authored and edmundnoble committed Jun 17, 2024
1 parent 0c54b73 commit 6c4db9d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions changes/2024-05-30T145526-0500.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Silence unnecessary `chainweb-node: RequestCancelled` logs from PactService, by catching them in the request worker.
13 changes: 12 additions & 1 deletion src/Chainweb/Pact/PactService.hs
Original file line number Diff line number Diff line change
Expand Up @@ -394,11 +394,22 @@ serviceRequests memPoolAccess reqQ = go
-- fork a thread to service the request
bracket
(forkIO $
flip finally (tryPutMVar finishedLock ()) $ do
-- We wrap this whole block in `tryAsync` because we
-- want to ignore `RequestCancelled` exceptions that
-- occur while we are waiting on `takeMVar goLock`.
--
-- Otherwise we get logs like `chainweb-node:
-- RequestCancelled`.
--
-- We don't actually care about whether or not
-- `RequestCancelled` was encountered, so we just `void`
-- it.
void $ tryAsync @_ @RequestCancelled $ flip finally (tryPutMVar finishedLock ()) $ do
-- wait until we've been told to start.
-- we don't want to start if the request was cancelled
-- already
takeMVar goLock

-- run and report the answer.
tryAny (run act) >>= \case
Left ex -> atomically $ writeTVar statusRef (RequestFailed ex)
Expand Down

0 comments on commit 6c4db9d

Please sign in to comment.