From 38a22490180c5e98d5ad105938a89ff31f29d349 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Thu, 5 Mar 2020 21:49:07 +0100 Subject: Storage: read object files strictly Avoids problem with exhausting file descriptors when waiting for unfinished lazy reads. --- src/Storage/Internal.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Storage/Internal.hs b/src/Storage/Internal.hs index 76adaab..5f5055a 100644 --- a/src/Storage/Internal.hs +++ b/src/Storage/Internal.hs @@ -121,7 +121,7 @@ ioLoadBytesFromStorage st dgst = loadCurrent st >>= Nothing | Just parent <- stParent st -> ioLoadBytesFromStorage parent dgst | otherwise -> return Nothing where loadCurrent Storage { stBacking = StorageDir { dirPath = spath } } = handleJust (guard . isDoesNotExistError) (const $ return Nothing) $ - Just . decompress <$> (BL.readFile $ refPath spath dgst) + Just . decompress . BL.fromChunks . (:[]) <$> (B.readFile $ refPath spath dgst) loadCurrent Storage { stBacking = StorageMemory { memObjs = tobjs } } = M.lookup dgst <$> readMVar tobjs refPath :: FilePath -> RefDigest -> FilePath -- cgit v1.2.3