File tree Expand file tree Collapse file tree 1 file changed +22
-2
lines changed Expand file tree Collapse file tree 1 file changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -470,7 +470,17 @@ function write_env_usage(source_file::AbstractString, usage_filepath::AbstractSt
470470 while true
471471 # read existing usage file
472472 usage = if isfile (usage_file)
473- TOML. parsefile (usage_file)
473+ retries = 0
474+ @label retry1
475+ try
476+ # If the file existed, but disappears during parse, keep trying and error if retries fail
477+ TOML. parsefile (usage_file)
478+ catch
479+ retries += 1
480+ retries > 20 && rethrow ()
481+ sleep (0.1 )
482+ @goto retry1
483+ end
474484 else
475485 Dict {String, Any} ()
476486 end
@@ -495,7 +505,17 @@ function write_env_usage(source_file::AbstractString, usage_filepath::AbstractSt
495505
496506 # Check that the new file has what we want in it
497507 new_usage = if isfile (usage_file)
498- TOML. parsefile (usage_file)
508+ retries = 0
509+ @label retry2
510+ try
511+ # If the file existed, but disappears during parse, keep trying and error if retries fail
512+ TOML. parsefile (usage_file)
513+ catch
514+ retries += 1
515+ retries > 20 && rethrow ()
516+ sleep (0.1 )
517+ @goto retry2
518+ end
499519 else
500520 Dict {String, Any} ()
501521 end
You can’t perform that action at this time.
0 commit comments