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.
This commit is contained in:
Joey Hess 2024-10-15 14:38:20 -04:00
parent 835283b862
commit f920d90781
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38

View file

@ -28,16 +28,15 @@ import Logs.UUID
import Logs.Location import Logs.Location
import Utility.Tmp.Dir import Utility.Tmp.Dir
import Utility.Metered import Utility.Metered
import Utility.ThreadScheduler
import Git.Types import Git.Types
import qualified Database.Export as Export import qualified Database.Export as Export
#ifndef mingw32_HOST_OS #ifndef mingw32_HOST_OS
import Utility.OpenFile import Utility.OpenFile
#endif #endif
import Control.Concurrent
import Control.Concurrent.STM import Control.Concurrent.STM
import Control.Concurrent.Async import Control.Concurrent.Async
import Control.Concurrent.MVar
import qualified Data.ByteString as B import qualified Data.ByteString as B
import qualified Data.ByteString as BS import qualified Data.ByteString as BS
import qualified Data.ByteString.Lazy as L 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 () Right sz | sz > 0 && sz >= offset -> return ()
_ -> ifM (isEmptyMVar cancelv <&&> isEmptyMVar donev) _ -> ifM (isEmptyMVar cancelv <&&> isEmptyMVar donev)
( do ( do
threadDelaySeconds (Seconds 1) threadDelay 40000
waitforfile waitforfile
, do , do
return () return ()
@ -317,7 +316,7 @@ proxySpecialRemote protoversion r ihdl ohdl owaitv oclosedv mexportdb = go
else do else do
-- Wait for more data to be -- Wait for more data to be
-- written to the file. -- written to the file.
threadDelaySeconds (Seconds 1) threadDelay 40000
getcontents n h getcontents n h
else if n' > 0 else if n' > 0
then do then do