Skip to content

Commit 4f32cbd

Browse files
authored
Merge pull request #106 from diogob/fix-connection-closing-when-no-write-mode-is-present
Prevent connection from closing when opening channels without write mode
2 parents 8027c0f + 25f7fc7 commit 4f32cbd

File tree

3 files changed

+2
-5
lines changed

3 files changed

+2
-5
lines changed

src/PostgresWebsockets/Config.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import APrelude
1818
import qualified Data.ByteString as BS
1919
import qualified Data.ByteString.Base64 as B64
2020
import Data.String (IsString (..))
21-
import Data.Text (intercalate, pack, replace, strip, stripPrefix)
21+
import Data.Text (intercalate, replace, strip, stripPrefix)
2222
import Data.Version (versionBranch)
2323
import Env
2424
import Network.Wai.Handler.Warp

src/PostgresWebsockets/HasqlBroadcast.hs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ import Data.Aeson (Value (..), decode)
2121
import qualified Data.Aeson.Key as Key
2222
import qualified Data.Aeson.KeyMap as JSON
2323
import Data.Either.Combinators (mapBoth)
24-
import Data.Function (id)
25-
import GHC.Show
2624
import Hasql.Connection
2725
import qualified Hasql.Decoders as HD
2826
import qualified Hasql.Encoders as HE

src/PostgresWebsockets/Middleware.hs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,7 @@ wsApp Context {..} pendingConn =
111111
when (hasWrite mode) $
112112
notifySession conn sendNotification chs
113113

114-
waitForever <- newEmptyMVar
115-
void $ takeMVar waitForever
114+
void $ forever $ threadDelay maxBound
116115

117116
-- Having both channel and claims as parameters seem redundant
118117
-- But it allows the function to ignore the claims structure and the source

0 commit comments

Comments
 (0)