mirror of
https://github.com/ArchiveBox/ArchiveBox.git
synced 2026-09-14 11:06:13 +05:00
Wait for captured files in async archive tests
This commit is contained in:
parent
fa4da3ee64
commit
b04c47a86f
@ -1411,7 +1411,16 @@ def wait_for_snapshot_capture(cwd: Path, url: str, timeout: int = 180) -> str:
|
||||
assert result.returncode == 0, result.stderr or result.stdout
|
||||
index_path = Path(result.stdout.strip().splitlines()[-1])
|
||||
_wait_for_log_match(index_path, ".", fixed=False, count=1, timeout=timeout)
|
||||
return get_snapshot_file_text(cwd, url)
|
||||
deadline = time.monotonic() + timeout
|
||||
last_error = ""
|
||||
while True:
|
||||
try:
|
||||
return get_snapshot_file_text(cwd, url)
|
||||
except AssertionError as err:
|
||||
last_error = str(err)
|
||||
remaining = deadline - time.monotonic()
|
||||
assert remaining > 0, last_error
|
||||
time.sleep(min(0.25, remaining))
|
||||
|
||||
|
||||
def get_counts(cwd: Path, scheduled_url: str, one_shot_url: str) -> tuple[int, int, int]:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user