diff options
author | Ben Sima <ben@bsima.me> | 2020-04-21 03:08:18 -0700 |
---|---|---|
committer | Ben Sima <ben@bsima.me> | 2020-04-21 03:28:45 -0700 |
commit | 732ce502822fc81e764ea43e7e1caed0ad6dfdfd (patch) | |
tree | 1aaf70e133ae892b014bc9fdd183299e096ac58a /Que | |
parent | dc71486565ba04d85815cc17344e2bc5393f65e6 (diff) |
Prevent empty channels from being created by mistake
Diffstat (limited to 'Que')
-rw-r--r-- | Que/Server.hs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Que/Server.hs b/Que/Server.hs index 8eda6fb..4cb0b32 100644 --- a/Que/Server.hs +++ b/Que/Server.hs @@ -54,6 +54,9 @@ import Network.Wai.Middleware.RequestLogger ) import qualified System.Envy as Envy import qualified Web.Scotty.Trans as Scotty +import qualified Prelude + +{-# ANN module ("HLint: ignore Reduce duplication" :: Prelude.String) #-} main :: IO () main = Exception.bracket startup shutdown <| uncurry Warp.run @@ -133,10 +136,10 @@ routes = do -- client. Scotty.get (Scotty.regex quepath) <| do (ns, qp) <- extract + guardNs ns ["pub", "_"] app . modify <| upsertNamespace ns q <- app <| que ns qp poll <- Scotty.param "poll" !: (pure . const False) - guardNs ns ["pub", "_"] if poll then Scotty.stream $ streamQue q else do |