mongodb-queue 0.2.0.0 → 0.2.0.1
raw patch · 3 files changed
+15/−4 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- Database/MongoDB/Queue.hs +2/−3
- mongodb-queue.cabal +1/−1
- test/main.hs +12/−0
Database/MongoDB/Queue.hs view
@@ -133,11 +133,10 @@ nextDoc cursor = do n <- next cursor case n of- Nothing -> liftIO $ throwIO $ TailableCursorError "tailable cursor ended"+ Nothing -> nextDoc cursor (Just doc) -> return doc data MongoQueueException = FindAndModifyError String- | TailableCursorError String deriving (Show, Typeable) instance Exception MongoQueueException @@ -149,7 +148,7 @@ nextFromQueue QueueWorker {..} = qwRunDB $ do origDoc <- nextDoc qwCursor {-`catch` (\e -> case e of- TailableCursorError "tailable cursor ended" -> do+ dead cursor cursor <- getCursor _ -> liftIO $ thowIO e )
mongodb-queue.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: mongodb-queue-version: 0.2.0.0+version: 0.2.0.1 synopsis: a queue using MongoDB -- description: homepage: https://github.com/gregwebs/haskell-mongodb-queue
test/main.hs view
@@ -5,6 +5,7 @@ import Prelude hiding (lookup) import Database.MongoDB import Database.MongoDB.Queue+import Control.Concurrent main :: IO ()@@ -18,3 +19,14 @@ doc <- nextFromQueue worker Just world <- lookup ("hello" :: Text) doc world `shouldBe` ("world" :: Text)++ it "should wait for a document to be inserted" $ do+ emitter <- createEmitter runDB+ worker <- createWorker runDB+ forkIO $ do+ threadDelay $ 1 * 1000 * 1000 -- microseconds, 1 second+ emit emitter [("hello" :: Text) =: ("world" :: Text)]+ doc <- nextFromQueue worker+ Just world <- lookup ("hello" :: Text) doc + world `shouldBe` ("world" :: Text)+ return ()