This commit is contained in:
Dmitry Zuikov 2023-02-26 17:32:52 +03:00
parent faf4d0eab7
commit 17210c96cc
1 changed files with 14 additions and 0 deletions

View File

@ -525,6 +525,20 @@ postponedLoop :: forall e m . ( MyPeer e
postponedLoop env0 = do
e <- ask
void $ liftIO $ async $ withPeerM e $ withDownload env0 do
-- wip <- asks (blockWip) >>= liftIO . Cache.keys
wip0 <- asks (view blockWip) >>= liftIO . Cache.keys <&> length
twip <- liftIO $ newTVarIO wip0
forever do
pause @'Seconds 10
wip1 <- asks (view blockWip) >>= liftIO . Cache.keys
when (wip0 == length wip1) do
trace "download stuck"
for_ wip1 $ \h -> do
removeFromWip h
addDownload h
void $ liftIO $ async $ withPeerM e $ withDownload env0 do
forever do