Skip to content

Commit a0411d8

Browse files
authored
Refine known_failures cache update handling (#3744)
## Changes - separate downloading of known_failures.txt from writing it to disk - maintain atomic replacement of the cached known_failures file ------ https://chatgpt.com/codex/tasks/task_e_68e7c56a98d88325aae2335e5f37e6b0 Original PR: denik#4
1 parent 3772d53 commit a0411d8

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

tools/gh_report.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,12 +130,17 @@ def download_known_failures():
130130
if file_age < 300: # 5 minutes
131131
return
132132

133+
temp_path = known_failures_path.with_name(f"{known_failures_path.name}.{os.getpid()}")
134+
133135
try:
134136
with urllib.request.urlopen(KNOWN_FAILURES_URL) as response:
135137
content = response.read().decode("utf-8")
136-
known_failures_path.write_text(content)
137138
except Exception as e:
138139
print(f"Failed to download known_failures.txt: {e}", file=sys.stderr)
140+
return
141+
142+
temp_path.write_text(content)
143+
temp_path.replace(known_failures_path)
139144

140145

141146
def download_run_id(run_id, repo, rm):

0 commit comments

Comments
 (0)