From 1c71f563e05f67998c473e1ea0225be10f8b6d0f Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 30 Oct 2018 22:19:32 -0400 Subject: [PATCH] explicitly close keys db in saveState Should be redundant, but test suite is ending up with a lot of extra sqlite connections before unused keys database handles get garbage collected. While running the test suite, I often saw 2-4+ open fds to the same repo's keys database. After this change, it seems to mostly have 1, occasionally 2. And that might explain some of the strange sqlite failures in the test suite. Especially the failures of test_lock_v7_force, where the keys database gets renamed to a new directory out from under sqlite. --- Annex/Content.hs | 1 + 1 file changed, 1 insertion(+) diff --git a/Annex/Content.hs b/Annex/Content.hs index 296eda8885..a42d01cc77 100644 --- a/Annex/Content.hs +++ b/Annex/Content.hs @@ -867,6 +867,7 @@ getKeysPresent keyloc = do saveState :: Bool -> Annex () saveState nocommit = doSideAction $ do Annex.Queue.flush + Database.Keys.closeDb unless nocommit $ whenM (annexAlwaysCommit <$> Annex.getGitConfig) $ Annex.Branch.commit =<< Annex.Branch.commitMessage