Exposed annex.forward-retry git config

One reason is, 5 is an arbitrary number so ought to be configurable.

The real reason though, is I wanted to make the man page explain when
forward retry can override annex.retry, and having a config made the
man page easier to write.
This commit is contained in:
Joey Hess 2020-09-04 15:16:40 -04:00
parent 2bb933eb60
commit e36bae74da
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
4 changed files with 26 additions and 8 deletions

View file

@ -217,13 +217,18 @@ stdRetry = combineRetryDeciders forwardRetry configuredRetry
- transfer left off, and so it would make sense to keep retrying forever,
- other remotes restart each transfer from the beginning, and so even if
- forward progress is being made, it's not real progress. So, retry a
- maximum of 5 times
- maximum of 5 times by default.
-}
forwardRetry :: RetryDecider
forwardRetry = \numretries old new -> pure $ and
[ fromMaybe 0 (bytesComplete old) < fromMaybe 0 (bytesComplete new)
, numretries <= 5
]
forwardRetry numretries old new
| fromMaybe 0 (bytesComplete old) < fromMaybe 0 (bytesComplete new) =
(numretries <=) <$> maybe globalretrycfg pure remoteretrycfg
| otherwise = return False
where
globalretrycfg = fromMaybe 5 . annexForwardRetry
<$> Annex.getGitConfig
remoteretrycfg = remoteAnnexRetry =<<
(Remote.gitconfig <$> transferRemote new)
{- Retries a number of times with growing delays in between when enabled
- by git configuration. -}