summaryrefslogtreecommitdiff
path: root/Database/Fsck.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2015-02-18 14:11:27 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2015-02-18 14:11:27 -0400
commit0a653b847cf792632d9da3d6cb95170d57b503d9 (patch)
tree432c838e114294c592f705034ba47cfaa91261ec /Database/Fsck.hs
parent2f95faac015c5a80a832d5c3327daca8d98427e7 (diff)
more robust handling of deferred commits
Still not robust enough. I have 3 fscks running concurrently, and am seeing: ("commit deferred",user error (SQLite3 returned ErrorBusy while attempting to perform step.)) and git-annex: user error (SQLite3 returned ErrorBusy while attempting to perform prepare "SELECT \"fscked\".\"key\"\nFROM \"fscked\"\nWHERE \"fscked\".\"key\" = ?\n": database is locked)
Diffstat (limited to 'Database/Fsck.hs')
-rw-r--r--Database/Fsck.hs6
1 files changed, 3 insertions, 3 deletions
diff --git a/Database/Fsck.hs b/Database/Fsck.hs
index ac3d03452..5301109bc 100644
--- a/Database/Fsck.hs
+++ b/Database/Fsck.hs
@@ -65,8 +65,8 @@ openDb u = do
unlessM (liftIO $ doesFileExist db) $ do
let newdb = db ++ ".new"
h <- liftIO $ H.openDb newdb
- void $ liftIO $ H.runDb h $
- runMigrationSilent migrateFsck
+ void $ liftIO $ H.commitDb h $
+ void $ runMigrationSilent migrateFsck
liftIO $ H.closeDb h
setAnnexFilePerm newdb
liftIO $ renameFile newdb db
@@ -87,7 +87,7 @@ addDb (FsckHandle h _) k = H.queueDb h 1000 $
sk = toSKey k
inDb :: FsckHandle -> Key -> IO Bool
-inDb (FsckHandle h _) = H.runDb h . inDb' . toSKey
+inDb (FsckHandle h _) = H.queryDb h . inDb' . toSKey
inDb' :: SKey -> SqlPersistM Bool
inDb' sk = do