Merge pull request #223 from fpco/master

Fix disk space leak
This commit is contained in:
Michael Snoyman 2017-02-23 22:06:53 +02:00 committed by GitHub
commit 8f649e0397
4 changed files with 8 additions and 0 deletions

View File

@ -4,6 +4,7 @@ module Stackage.Database
, SnapName (..)
, SnapshotId ()
, Snapshot (..)
, closeStackageDatabase
, newestSnapshot
, newestLTS
, newestLTSMajor
@ -73,6 +74,7 @@ import qualified Database.Esqueleto as E
import Data.Yaml (decode)
import qualified Data.Aeson as A
import Types (SnapshotBranch(..))
import Data.Pool (destroyAllResources)
currentSchema :: Int
currentSchema = 1
@ -153,6 +155,9 @@ _hideUnusedWarnings _ = ()
newtype StackageDatabase = StackageDatabase ConnectionPool
closeStackageDatabase :: StackageDatabase -> IO ()
closeStackageDatabase (StackageDatabase pool) = destroyAllResources pool
class MonadIO m => GetStackageDatabase m where
getStackageDatabase :: m StackageDatabase
instance MonadIO m => GetStackageDatabase (ReaderT StackageDatabase m) where

View File

@ -106,6 +106,7 @@ loadFromS3 develMode man = do
-- give existing users a chance to clean up
threadDelay $ 1000000 * 30
void $ tryIO $ removeFile (fromString fp)
closeStackageDatabase db
return oldKill
update

View File

@ -11,3 +11,4 @@ extra-deps:
- wai-middleware-prometheus-0.1.0.1
- hoogle-5.0.6
- haskell-src-exts-1.19.0
- persistent-sqlite-2.2.1.1

View File

@ -184,6 +184,7 @@ library
, amazonka-s3 >= 1.3 && < 1.5
, lens >= 4.13 && < 4.14
, file-embed
, resource-pool
executable stackage-server
if flag(library-only)