From f920d9078128f421f4102c7d581f5a82a2b250f6 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 15 Oct 2024 14:38:20 -0400 Subject: [PATCH] smaller delay in proxy streamer A one second delay made it seem really choppy and slow when the special remote was sending content fairly steadily but was bottlenecked on running gpg on 10 mb chunks. This does not appreciably increase CPU, although of course if the special remote is very slow it will add up over time. It would perhaps be better to use inotify, like tailVerify does. --- Annex/Proxy.hs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Annex/Proxy.hs b/Annex/Proxy.hs index 467782fc57..cedf0dff58 100644 --- a/Annex/Proxy.hs +++ b/Annex/Proxy.hs @@ -28,16 +28,15 @@ import Logs.UUID import Logs.Location import Utility.Tmp.Dir import Utility.Metered -import Utility.ThreadScheduler import Git.Types import qualified Database.Export as Export #ifndef mingw32_HOST_OS import Utility.OpenFile #endif +import Control.Concurrent import Control.Concurrent.STM import Control.Concurrent.Async -import Control.Concurrent.MVar import qualified Data.ByteString as B import qualified Data.ByteString as BS import qualified Data.ByteString.Lazy as L @@ -300,7 +299,7 @@ proxySpecialRemote protoversion r ihdl ohdl owaitv oclosedv mexportdb = go Right sz | sz > 0 && sz >= offset -> return () _ -> ifM (isEmptyMVar cancelv <&&> isEmptyMVar donev) ( do - threadDelaySeconds (Seconds 1) + threadDelay 40000 waitforfile , do return () @@ -317,7 +316,7 @@ proxySpecialRemote protoversion r ihdl ohdl owaitv oclosedv mexportdb = go else do -- Wait for more data to be -- written to the file. - threadDelaySeconds (Seconds 1) + threadDelay 40000 getcontents n h else if n' > 0 then do -- 2.30.2