Skip to content

Commit b96868f

Browse files
committed
Auto merge of #145559 - marcoieni:free-disk-timeout, r=Kobzol
ci: add timeout to windows disk cleanup wait
2 parents 9eb4a26 + 4f72482 commit b96868f

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

src/ci/scripts/free-disk-space-windows-wait.py

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,27 @@ def read_pid_from_file() -> int:
6161
) from e
6262

6363

64-
def main() -> int:
65-
pid = read_pid_from_file()
64+
def wait_for_process(pid: int):
65+
timeout_duration_seconds = 5 * 60
66+
interval_seconds = 3
67+
max_attempts = timeout_duration_seconds / interval_seconds
68+
attempts = 0
6669

6770
# Poll until process exits
6871
while is_process_running(pid):
69-
time.sleep(3)
72+
if attempts >= max_attempts:
73+
print(
74+
"::warning::Timeout expired while waiting for the disk cleanup process to finish."
75+
)
76+
break
77+
time.sleep(interval_seconds)
78+
attempts += 1
79+
80+
81+
def main() -> int:
82+
pid = read_pid_from_file()
83+
84+
wait_for_process(pid)
7085

7186
print_logs()
7287

0 commit comments

Comments
 (0)