From 732ce502822fc81e764ea43e7e1caed0ad6dfdfd Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Tue, 21 Apr 2020 03:08:18 -0700 Subject: Prevent empty channels from being created by mistake --- Que/Server.hs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'Que/Server.hs') 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 -- cgit v1.2.3