chore: more transactions with filesystem actions cleanup

This commit is contained in:
2026-05-01 16:19:50 +02:00
parent 3133beffcb
commit 7f5077c6ad
8 changed files with 177 additions and 50 deletions

View File

@@ -66,10 +66,10 @@ defmodule BDS.Persistence do
def parse_timestamp(_value), do: nil
def atomic_write(path, contents) when is_binary(path) and is_binary(contents) do
:ok = File.mkdir_p(Path.dirname(path))
temp_path = path <> ".tmp"
with :ok <- File.write(temp_path, contents),
with :ok <- File.mkdir_p(Path.dirname(path)),
:ok <- File.write(temp_path, contents),
:ok <- File.rename(temp_path, path) do
:ok
else