2

编码

mapConcurrently httpLBS requests

投掷

ConnectionFailure Network.BSD.getProtocolByName: does not exist (no such protocol name: tcp))

在大约 1k 个请求之后。

4

1 回答 1

5

这些请求都是并行运行的,并使进程用完文件描述符。采用

import ClassyPrelude

traverseThrottled :: (MonadMask m, MonadBaseControl IO m, Forall (Pure m), Traversable t) => Int -> (a -> m b) -> t a -> m (t b)
traverseThrottled concLevel action taskContainer = do
    sem <- newQSem concLevel
    let throttledAction = bracket_ (waitQSem sem) (signalQSem sem) . action
    mapConcurrently throttledAction taskContainer

(如果您不使用,请调整导入ClassyPrelude

httpLBS如果您使用流式传输替代方案,请确保您的等价物使用该请求。而且你b在所有领域都很严格。

于 2017-11-06T19:34:24.600 回答