]> gitweb @ CieloNegro.org - Rakka.git/blobdiff - Rakka/Storage/Impl.hs
Code cleanup
[Rakka.git] / Rakka / Storage / Impl.hs
index e1bad11015a987b32d95d079594ae731550f85fb..bedc9eaa2808d3142e5d4abf91cd00d724369401 100644 (file)
@@ -12,6 +12,7 @@ module Rakka.Storage.Impl
 
 import           Control.Concurrent
 import           Control.Concurrent.STM
+import           Control.Exception
 import           Control.Monad
 import           Data.Maybe
 import           Data.Set (Set)
@@ -107,7 +108,7 @@ startIndexManager :: FilePath -> Repository -> (Page -> IO Document) -> IO (TCha
 startIndexManager lsdir repos mkDraft
     = do chan  <- newTChanIO
          index <- openIndex indexDir revFile
-         _     <- forkIO (loop chan index)
+         _     <- forkIO (loop chan index `finally` closeDatabase index)
          return chan
     where
       indexDir = lsdir </> "index"