Skip to content

Commit

Permalink
Write state file atomically in `maintenance_mode.backends.LocalFileBa…
Browse files Browse the repository at this point in the history
…ckend`. #162
  • Loading branch information
fabiocaccamo committed Dec 11, 2023
1 parent 3f7be7e commit 75dbb1d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions maintenance_mode/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def read_file(file_path, default_content=""):
Returns the file content.
"""
if not fsutil.exists(file_path):
fsutil.write_file(file_path, default_content)
fsutil.write_file(file_path, default_content, atomic=True)
return fsutil.read_file(file_path) or default_content


Expand All @@ -17,4 +17,4 @@ def write_file(file_path, content):
Write file at the specified path with content.
If file exists, it will be overwritten.
"""
fsutil.write_file(file_path, content)
fsutil.write_file(file_path, content, atomic=True)
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ classifiers = [
"Topic :: Software Development :: Build Tools",
]
dependencies = [
"python-fsutil >= 0.9.2, < 1.0.0",
"python-fsutil >= 0.12.0, < 1.0.0",
]
dynamic = ["version"]
maintainers = [
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
django >= 2.2
python-fsutil == 0.11.0
python-fsutil == 0.12.0

0 comments on commit 75dbb1d

Please sign in to comment.