From 0182c7514450df9c70becd201fb88cc849233fe8 Mon Sep 17 00:00:00 2001 From: Dmitry Zuikov Date: Sun, 23 Feb 2025 18:02:26 +0300 Subject: [PATCH] block upload degradation fix? --- hbs2-peer/app/PeerMain.hs | 4 ++-- hbs2-peer/lib/HBS2/Peer/Proto/BlockChunks.hs | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/hbs2-peer/app/PeerMain.hs b/hbs2-peer/app/PeerMain.hs index 3015d37d..9e324657 100644 --- a/hbs2-peer/app/PeerMain.hs +++ b/hbs2-peer/app/PeerMain.hs @@ -830,9 +830,9 @@ runPeer opts = respawnOnError opts $ do simpleStorageSetProbe s stoProbe addProbe stoProbe - stn <- getNumCapabilities -- <&> max 2 . div 2 + stn <- getNumCapabilities <&> max 2 . div 1 - w <- replicateM stn $ async $ liftIO $ simpleStorageWorker s + w <- replicateM stn $ asyncBound $ liftIO $ simpleStorageWorker s localMulticast <- liftIO $ (headMay <$> parseAddrUDP (fromString defLocalMulticast) <&> fmap (fromSockAddr @'UDP . addrAddress) ) diff --git a/hbs2-peer/lib/HBS2/Peer/Proto/BlockChunks.hs b/hbs2-peer/lib/HBS2/Peer/Proto/BlockChunks.hs index b3272017..1af3be2d 100644 --- a/hbs2-peer/lib/HBS2/Peer/Proto/BlockChunks.hs +++ b/hbs2-peer/lib/HBS2/Peer/Proto/BlockChunks.hs @@ -99,12 +99,12 @@ blockChunksProto adapter (BlockChunks c p) = do bsz' <- blkSize adapter h - maybe1 bsz' (pure ()) $ \bsz -> deferred @proto do + maybe1 bsz' (pure ()) $ \bsz -> do let offsets' = calcChunks bsz (fromIntegral size) :: [(Offset, Size)] let offsets = take (fromIntegral num) $ drop (fromIntegral n1) $ zip offsets' [0..] - for_ offsets $ \((o,sz),i) -> do + for_ offsets $ \((o,sz),i) -> deferred @proto do chunk <- blkChunk adapter h o sz maybe (pure ()) (response_ . BlockChunk @e i) chunk @@ -117,7 +117,7 @@ blockChunksProto adapter (BlockChunks c p) = do let offsets' = calcChunks bsz (fromIntegral size) :: [(Offset, Size)] let offsets = zip offsets' [0..] - for_ offsets $ \((o,sz),i) -> do + for_ offsets $ \((o,sz),i) -> deferred @proto do chunk <- blkChunk adapter h o sz maybe (pure ()) (response_ . BlockChunk @e i) chunk