Preserve outbound backlog across outages, fix backoff quiet period
This commit is contained in:
@@ -15,6 +15,7 @@ import Control.Concurrent.STM
|
||||
, writeTChan
|
||||
, writeTVar
|
||||
)
|
||||
import Control.Exception (onException)
|
||||
import Control.Exception.Annotated (throw)
|
||||
import Control.Lens ((^?))
|
||||
import Control.Monad (forever)
|
||||
@@ -38,7 +39,8 @@ readerAction host port token bus =
|
||||
subscribe bus conn
|
||||
atomically $ writeTVar (busConn bus) (Just conn)
|
||||
putStrLn "[reader] connected"
|
||||
receiveLoop bus conn
|
||||
-- Unpublish on exit so the writer blocks and the backlog survives the outage.
|
||||
receiveLoop bus conn `onException` atomically (writeTVar (busConn bus) Nothing)
|
||||
|
||||
handshake :: WS.Connection -> String -> IO ()
|
||||
handshake conn token = do
|
||||
|
||||
Reference in New Issue
Block a user