summaryrefslogtreecommitdiff
path: root/src/Erebos/Storage
diff options
context:
space:
mode:
Diffstat (limited to 'src/Erebos/Storage')
-rw-r--r--src/Erebos/Storage/Internal.hs3
-rw-r--r--src/Erebos/Storage/Memory.hs4
2 files changed, 3 insertions, 4 deletions
diff --git a/src/Erebos/Storage/Internal.hs b/src/Erebos/Storage/Internal.hs
index 59d0af0..6df1410 100644
--- a/src/Erebos/Storage/Internal.hs
+++ b/src/Erebos/Storage/Internal.hs
@@ -3,6 +3,7 @@ module Erebos.Storage.Internal where
import Control.Arrow
import Control.Concurrent
import Control.DeepSeq
+import Control.Exception
import Control.Monad
import Control.Monad.Identity
@@ -270,7 +271,7 @@ instance StorageCompleteness Partial where
unsafeStoreRawBytes :: Storage' c -> BL.ByteString -> IO (Ref' c)
unsafeStoreRawBytes st@Storage {..} raw = do
- let dgst = hashToRefDigest raw
+ dgst <- evaluate $ force $ hashToRefDigest raw
backendStoreBytes stBackend dgst raw
return $ Ref st dgst
diff --git a/src/Erebos/Storage/Memory.hs b/src/Erebos/Storage/Memory.hs
index dd382b6..677e8c5 100644
--- a/src/Erebos/Storage/Memory.hs
+++ b/src/Erebos/Storage/Memory.hs
@@ -5,7 +5,6 @@ module Erebos.Storage.Memory (
) where
import Control.Concurrent.MVar
-import Control.DeepSeq
import Data.ByteArray (ScrubbedBytes)
import Data.ByteString.Lazy qualified as BL
@@ -46,8 +45,7 @@ instance (StorageCompleteness c, Typeable p) => StorageBackend (MemoryStorage p
M.lookup dgst <$> readMVar memObjs
backendStoreBytes StorageMemory {..} dgst raw =
- dgst `deepseq` -- the TVar may be accessed when evaluating the data to be written
- modifyMVar_ memObjs (return . M.insert dgst raw)
+ modifyMVar_ memObjs (return . M.insert dgst raw)
backendLoadHeads StorageMemory {..} tid = do