Skip to content

Commit

Permalink
Use try to avoid race condition on file glob (Chia-Network#140)
Browse files Browse the repository at this point in the history
* Use try to avoid race condition on file glob

* initialize used
  • Loading branch information
hoffmang9 authored Dec 10, 2020
1 parent f63fdef commit 08d153b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tests/plot-resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,12 @@ def pollSpace():

tempdirpath = os.getcwd() + "/" + tempdir
print("Temporary directory path is " + tempdirpath)
used = 0
while bPollSpace:
used = get_size(tempdirpath)
try:
used = get_size(tempdirpath)
except used.TempFileDeleted:
print("A temp file was deleted while polling. Skipping.")
if used > pollDisk:
pollDisk = used

Expand Down

0 comments on commit 08d153b

Please sign in to comment.