Skip to content

Commit

Permalink
docs(file_watcher): Atomic writes to watched files (#755)
Browse files Browse the repository at this point in the history
Add documentation pointing out that if writes to watched files aren't
atomic, file contents observed by clients may be currupted,
w
  • Loading branch information
KTAtkinson authored Nov 18, 2022
1 parent 8f06455 commit bc2d21f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions baseplate/lib/file_watcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
The contents of the file are re-loaded and parsed only when necessary.
Warning! Writes to watched files must be atomic, otherwise the client might read
a currupt or partly written data file. One way to avoid this issue is to write all
the desired data to a temporary file and move the complete temp file over the old
file.
For example, a JSON file like the following:
.. highlight:: ini
Expand Down

0 comments on commit bc2d21f

Please sign in to comment.