git-annex-shell sendkey: Don't fail if a remote asks for a key to be sent that already has a transfer lock file indicating it's being sent to that remote. The remote may have moved between networks, or reconnected.
This commit is contained in:
parent
d6e4514444
commit
852185c242
4 changed files with 27 additions and 2 deletions
|
@ -12,6 +12,7 @@ module Annex.Transfer (
|
||||||
upload,
|
upload,
|
||||||
download,
|
download,
|
||||||
runTransfer,
|
runTransfer,
|
||||||
|
alwaysRunTransfer,
|
||||||
noRetry,
|
noRetry,
|
||||||
forwardRetry,
|
forwardRetry,
|
||||||
) where
|
) where
|
||||||
|
@ -46,12 +47,23 @@ download u key f d a _witness = runTransfer (Transfer Download u key) f d a
|
||||||
- no transfer information or lock file is used.
|
- no transfer information or lock file is used.
|
||||||
-}
|
-}
|
||||||
runTransfer :: Transfer -> Maybe FilePath -> RetryDecider -> (MeterUpdate -> Annex Bool) -> Annex Bool
|
runTransfer :: Transfer -> Maybe FilePath -> RetryDecider -> (MeterUpdate -> Annex Bool) -> Annex Bool
|
||||||
runTransfer t file shouldretry a = do
|
runTransfer = runTransfer' False
|
||||||
|
|
||||||
|
{- Like runTransfer, but ignores any existing transfer lock file for the
|
||||||
|
- transfer, allowing re-running a transfer that is already in progress.
|
||||||
|
-
|
||||||
|
- Note that this may result in confusing progress meter display in the
|
||||||
|
- webapp, if multiple processes are writing to the transfer info file. -}
|
||||||
|
alwaysRunTransfer :: Transfer -> Maybe FilePath -> RetryDecider -> (MeterUpdate -> Annex Bool) -> Annex Bool
|
||||||
|
alwaysRunTransfer = runTransfer' True
|
||||||
|
|
||||||
|
runTransfer' :: Bool -> Transfer -> Maybe FilePath -> RetryDecider -> (MeterUpdate -> Annex Bool) -> Annex Bool
|
||||||
|
runTransfer' ignorelock t file shouldretry a = do
|
||||||
info <- liftIO $ startTransferInfo file
|
info <- liftIO $ startTransferInfo file
|
||||||
(meter, tfile, metervar) <- mkProgressUpdater t info
|
(meter, tfile, metervar) <- mkProgressUpdater t info
|
||||||
mode <- annexFileMode
|
mode <- annexFileMode
|
||||||
(fd, inprogress) <- liftIO $ prep tfile mode info
|
(fd, inprogress) <- liftIO $ prep tfile mode info
|
||||||
if inprogress
|
if inprogress && not ignorelock
|
||||||
then do
|
then do
|
||||||
showNote "transfer already in progress"
|
showNote "transfer already in progress"
|
||||||
return False
|
return False
|
||||||
|
|
|
@ -47,3 +47,11 @@ fieldTransfer direction key a = do
|
||||||
(\u -> runTransfer (Transfer direction (toUUID u) key) afile noRetry a)
|
(\u -> runTransfer (Transfer direction (toUUID u) key) afile noRetry a)
|
||||||
=<< Fields.getField Fields.remoteUUID
|
=<< Fields.getField Fields.remoteUUID
|
||||||
liftIO $ exitBool ok
|
liftIO $ exitBool ok
|
||||||
|
where
|
||||||
|
{- Allow the key to be sent to the remote even if there seems to be
|
||||||
|
- another transfer of that key going on to that remote.
|
||||||
|
- That one may be stale, etc.
|
||||||
|
-}
|
||||||
|
runner
|
||||||
|
| direction == Upload = alwaysRunTransfer
|
||||||
|
| otherwise = runTransfer
|
||||||
|
|
3
debian/changelog
vendored
3
debian/changelog
vendored
|
@ -36,6 +36,9 @@ git-annex (5.20140718) UNRELEASED; urgency=medium
|
||||||
* S3, Glacier, WebDAV: Fix bug that prevented accessing the creds
|
* S3, Glacier, WebDAV: Fix bug that prevented accessing the creds
|
||||||
when the repository was configured with encryption=shared embedcreds=yes.
|
when the repository was configured with encryption=shared embedcreds=yes.
|
||||||
* direct: Avoid leaving file content in misctemp if interrupted.
|
* direct: Avoid leaving file content in misctemp if interrupted.
|
||||||
|
* git-annex-shell sendkey: Don't fail if a remote asks for a key to be sent
|
||||||
|
that already has a transfer lock file indicating it's being sent to that
|
||||||
|
remote. The remote may have moved between networks, or reconnected.
|
||||||
|
|
||||||
-- Joey Hess <joeyh@debian.org> Mon, 21 Jul 2014 14:41:26 -0400
|
-- Joey Hess <joeyh@debian.org> Mon, 21 Jul 2014 14:41:26 -0400
|
||||||
|
|
||||||
|
|
|
@ -29,3 +29,5 @@ git-annex: copy: 1 failed
|
||||||
workaround: `cd .git/annex/; mv transfer transfer.old` on the other side.
|
workaround: `cd .git/annex/; mv transfer transfer.old` on the other side.
|
||||||
|
|
||||||
-- [[anarcat]]
|
-- [[anarcat]]
|
||||||
|
|
||||||
|
> [[fixed|done]] --[[Joey]]
|
||||||
|
|
Loading…
Reference in a new issue