Retrieve another batch for next in case of unlimited request
This commit is contained in:
parent
bbba3f37ea
commit
75470af421
1 changed files with 2 additions and 2 deletions
|
@ -49,7 +49,7 @@ import Prelude hiding (lookup)
|
||||||
import Control.Exception (Exception, throwIO)
|
import Control.Exception (Exception, throwIO)
|
||||||
import Control.Monad (unless, replicateM, liftM)
|
import Control.Monad (unless, replicateM, liftM)
|
||||||
import Data.Int (Int32)
|
import Data.Int (Int32)
|
||||||
import Data.Maybe (listToMaybe, catMaybes)
|
import Data.Maybe (listToMaybe, catMaybes, isNothing)
|
||||||
import Data.Word (Word32)
|
import Data.Word (Word32)
|
||||||
#if !MIN_VERSION_base(4,8,0)
|
#if !MIN_VERSION_base(4,8,0)
|
||||||
import Data.Monoid (mappend)
|
import Data.Monoid (mappend)
|
||||||
|
@ -628,7 +628,7 @@ next (Cursor fcol batchSize var) = modifyMVar var nextState where
|
||||||
let newLimit = do
|
let newLimit = do
|
||||||
limit <- mLimit
|
limit <- mLimit
|
||||||
return $ limit - 1
|
return $ limit - 1
|
||||||
dBatch' <- if null docs' && cid /= 0 && (newLimit > (Just 0))
|
dBatch' <- if null docs' && cid /= 0 && ((newLimit > (Just 0)) || (isNothing newLimit))
|
||||||
then nextBatch' fcol batchSize newLimit cid
|
then nextBatch' fcol batchSize newLimit cid
|
||||||
else return $ return (Batch newLimit cid docs')
|
else return $ return (Batch newLimit cid docs')
|
||||||
when (newLimit == (Just 0)) $ unless (cid == 0) $ send [KillCursors [cid]]
|
when (newLimit == (Just 0)) $ unless (cid == 0) $ send [KillCursors [cid]]
|
||||||
|
|
Loading…
Reference in a new issue