diff options
author | 2016-05-16 14:49:12 -0400 | |
---|---|---|
committer | 2016-05-16 14:49:12 -0400 | |
commit | d7820aa98ad0fe973d0a1aae2861abdab60de7a5 (patch) | |
tree | 5699a9b4ea84ff89931247fe527e9c0f44e06215 /Command/TransferKeys.hs | |
parent | 0346651ab6ef0c53aa7e0daffd821863858081fe (diff) |
assistant: Fix race in v6 mode that caused downloaded file content to sometimes not replace pointer files.
The keys database handle needs to be closed after merging, because the
smudge filter, in another process, updates the database. Old cached info
can be read for a while from the open database handle; closing it ensures
that the info written by the smudge filter is available.
This is pretty horribly ad-hoc, and it's especially nasty that the
transferrer closes the database every time.
Diffstat (limited to 'Command/TransferKeys.hs')
-rw-r--r-- | Command/TransferKeys.hs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/Command/TransferKeys.hs b/Command/TransferKeys.hs index 005e491b4..82dc15032 100644 --- a/Command/TransferKeys.hs +++ b/Command/TransferKeys.hs @@ -16,6 +16,7 @@ import Annex.Transfer import qualified Remote import Utility.SimpleProtocol (dupIoHandles) import Git.Types (RemoteName) +import qualified Database.Keys data TransferRequest = TransferRequest Direction Remote Key AssociatedFile @@ -41,8 +42,13 @@ start = do return ok | otherwise = notifyTransfer direction file $ download (Remote.uuid remote) key file forwardRetry observer $ \p -> - getViaTmp (RemoteVerify remote) key $ \t -> - Remote.retrieveKeyFile remote key file t p + getViaTmp (RemoteVerify remote) key $ \t -> do + r <- Remote.retrieveKeyFile remote key file t p + -- Make sure we get the current + -- associated files data for the key, + -- not old cached data. + Database.Keys.closeDb + return r observer False t tinfo = recordFailedTransfer t tinfo observer True _ _ = noop |