From d7820aa98ad0fe973d0a1aae2861abdab60de7a5 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 16 May 2016 14:49:12 -0400 Subject: 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. --- Command/TransferKeys.hs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'Command/TransferKeys.hs') 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 -- cgit v1.2.3