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.
This commit is contained in:
Joey Hess 2018-10-30 22:19:32 -04:00
parent fcc9eea554
commit 1c71f563e0
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38

View file

@ -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