aboutsummaryrefslogtreecommitdiff
path: root/Database/Handle.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2015-02-17 13:03:57 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2015-02-17 13:03:57 -0400
commitd14b4c2a607409fbec81fedd2cc89ee77ba6a62e (patch)
treeeab44cbbdd0175c20ab05f17223348ae6f99c3c3 /Database/Handle.hs
parent6591a9b53bdbfdae2b5bef69cfa6bc6e97f0ac35 (diff)
show error when sqlite crashes worker thread
Better than "blocked indefinitely in MVar"..
Diffstat (limited to 'Database/Handle.hs')
-rw-r--r--Database/Handle.hs4
1 files changed, 3 insertions, 1 deletions
diff --git a/Database/Handle.hs b/Database/Handle.hs
index 5c4fcca38..691902a80 100644
--- a/Database/Handle.hs
+++ b/Database/Handle.hs
@@ -16,6 +16,7 @@ module Database.Handle (
) where
import Utility.Exception
+import Messages
import Database.Persist.Sqlite (runSqlite)
import Database.Esqueleto hiding (Key)
@@ -41,8 +42,9 @@ openDb db = do
return $ DbHandle worker jobs t
workerThread :: T.Text -> MVar Job -> IO ()
-workerThread db jobs = go
+workerThread db jobs = catchNonAsync go showerr
where
+ showerr e = liftIO $ warningIO $ "sqlite worker thread crashed: " ++ show e
go = do
r <- runSqlite db transaction
case r of