Skip to content

Commit

Permalink
Unsafe persistence as well
Browse files Browse the repository at this point in the history
  • Loading branch information
noonio committed Nov 21, 2024
1 parent 719025f commit e3559f1
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions hydra-node/src/Hydra/Persistence.hs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import Data.ByteString qualified as BS
import Data.ByteString.Char8 qualified as C8
import System.Directory (createDirectoryIfMissing, doesFileExist)
import System.FilePath (takeDirectory)
import UnliftIO.IO.File (withBinaryFile, writeBinaryFileDurableAtomic)
import UnliftIO.IO.File (withBinaryFile, writeBinaryFile)

data PersistenceException
= PersistenceException String
Expand All @@ -37,7 +37,8 @@ createPersistence fp = do
pure $
Persistence
{ save = \a -> do
writeBinaryFileDurableAtomic fp . toStrict $ Aeson.encode a
-- FIXME: this is not atomic / durable
writeBinaryFile fp . toStrict $ Aeson.encode a
, load =
liftIO (doesFileExist fp) >>= \case
False -> pure Nothing
Expand Down

0 comments on commit e3559f1

Please sign in to comment.