fix --time-limit
It got broken in several ways by the streaming seeking optimisations around version 8.20201007. Moved time limit checking out of the matcher, which was a hack in the first place. So everywhere that uses Limit.getMatcher needs to check time limit. Well, almost everywhere. Command.Info uses it, but it does not make sense to time limit getting info. And Command.MultiCast uses it just to build up a list of files that then get passed to a command, so it would never have hit the timeout in a useful way. This implementation is a little more expensive when at time limit than necessary, since it continues seeking only to discard everything after the time limit. I did try making it close the file handles to force a faster shutdown, but that didn't work and hung. Could certianly be improved somehow, but seeking is probably not the expensive bit when a time limit is hit, so this seems acceptable for now.
This commit is contained in:
parent
a5511c32d7
commit
a3a19518d8
6 changed files with 73 additions and 40 deletions
6
Annex.hs
6
Annex.hs
|
@ -1,6 +1,6 @@
|
|||
{- git-annex monad
|
||||
-
|
||||
- Copyright 2010-2020 Joey Hess <id@joeyh.name>
|
||||
- Copyright 2010-2021 Joey Hess <id@joeyh.name>
|
||||
-
|
||||
- Licensed under the GNU AGPL version 3 or higher.
|
||||
-}
|
||||
|
@ -78,6 +78,7 @@ import qualified Database.Keys.Handle as Keys
|
|||
import Utility.InodeCache
|
||||
import Utility.Url
|
||||
import Utility.ResourcePool
|
||||
import Utility.HumanTime
|
||||
|
||||
import "mtl" Control.Monad.Reader
|
||||
import Control.Concurrent
|
||||
|
@ -85,6 +86,7 @@ import Control.Concurrent.STM
|
|||
import qualified Control.Monad.Fail as Fail
|
||||
import qualified Data.Map.Strict as M
|
||||
import qualified Data.Set as S
|
||||
import Data.Time.Clock.POSIX
|
||||
|
||||
{- git-annex's monad is a ReaderT around an AnnexState stored in a MVar.
|
||||
- The MVar is not exposed outside this module.
|
||||
|
@ -133,6 +135,7 @@ data AnnexState = AnnexState
|
|||
, globalnumcopies :: Maybe NumCopies
|
||||
, forcenumcopies :: Maybe NumCopies
|
||||
, limit :: ExpandableMatcher Annex
|
||||
, timelimit :: Maybe (Duration, POSIXTime)
|
||||
, uuiddescmap :: Maybe UUIDDescMap
|
||||
, preferredcontentmap :: Maybe (FileMatcherMap Annex)
|
||||
, requiredcontentmap :: Maybe (FileMatcherMap Annex)
|
||||
|
@ -201,6 +204,7 @@ newState c r = do
|
|||
, globalnumcopies = Nothing
|
||||
, forcenumcopies = Nothing
|
||||
, limit = BuildingMatcher []
|
||||
, timelimit = Nothing
|
||||
, uuiddescmap = Nothing
|
||||
, preferredcontentmap = Nothing
|
||||
, requiredcontentmap = Nothing
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue