Skip to content

Prevent connection from closing when opening channels without write mode #106

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/PostgresWebsockets/Config.hs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import APrelude
import qualified Data.ByteString as BS
import qualified Data.ByteString.Base64 as B64
import Data.String (IsString (..))
import Data.Text (intercalate, pack, replace, strip, stripPrefix)
import Data.Text (intercalate, replace, strip, stripPrefix)
import Data.Version (versionBranch)
import Env
import Network.Wai.Handler.Warp
Expand Down
2 changes: 0 additions & 2 deletions src/PostgresWebsockets/HasqlBroadcast.hs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ import Data.Aeson (Value (..), decode)
import qualified Data.Aeson.Key as Key
import qualified Data.Aeson.KeyMap as JSON
import Data.Either.Combinators (mapBoth)
import Data.Function (id)
import GHC.Show
import Hasql.Connection
import qualified Hasql.Decoders as HD
import qualified Hasql.Encoders as HE
Expand Down
3 changes: 1 addition & 2 deletions src/PostgresWebsockets/Middleware.hs
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,7 @@ wsApp Context {..} pendingConn =
when (hasWrite mode) $
notifySession conn sendNotification chs

waitForever <- newEmptyMVar
void $ takeMVar waitForever
void $ forever $ threadDelay maxBound

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