Skip to content

Commit b7e1ccf

Browse files
committed
Cancel PGListener reader async when a subscription is stopped
This avoids asyncs building up over time
1 parent 3c77188 commit b7e1ccf

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

IHP/PGListener.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ unsubscribe subscription@(Subscription { .. }) pgListener = do
164164
deleteById :: [Subscription] -> [Subscription]
165165
deleteById = List.deleteBy (\a b -> get #id a == get #id b) subscription
166166
modifyIORef' (get #subscriptions pgListener) (HashMap.adjust deleteById channel)
167+
uninterruptibleCancel reader
167168
pure ()
168169

169170
-- | Runs a @LISTEN ..;@ statements on the postgres connection, if not already listening on that channel

0 commit comments

Comments
 (0)