Skip to content

Commit 5a3b9e4

Browse files
committed
refactor(cached_session): improve page reload wait handling
1 parent c6384ee commit 5a3b9e4

4 files changed

Lines changed: 8 additions & 8 deletions

File tree

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ dependencies = [
2323
"python-keycloak ==5.8.1",
2424
"requests ==2.32.5",
2525
"requests-cache ==1.2.1",
26-
"cafi @ git+https://github.com/LeibnizDSMZ/cafi.git@v0.9.8",
26+
"cafi @ git+https://github.com/LeibnizDSMZ/cafi.git@v0.9.12",
2727
]
2828

2929
[project.scripts]

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ attrs==25.4.0 \
2323
# via
2424
# cattrs
2525
# requests-cache
26-
cafi @ git+https://github.com/LeibnizDSMZ/cafi.git@1b5f00c0491a6f8202655eda8a83599fd8267f98
26+
cafi @ git+https://github.com/LeibnizDSMZ/cafi.git@b1e97db396b1a99e4072ab16ea9893670ee5da8b
2727
# via saim
2828
cattrs==25.3.0 \
2929
--hash=sha256:1ac88d9e5eda10436c4517e390a4142d88638fe682c436c93db7ce4a277b884a \

src/saim/culture_link/private/cached_session.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -214,18 +214,18 @@ async def __send(
214214
if resp is not None:
215215
break
216216
resp = await _get_resp(
217-
lambda: page.reload(timeout=tout_msec, wait_until="commit"),
217+
lambda: page.reload(timeout=tout_msec, wait_until="load"),
218218
err_str,
219219
)
220220
start = time.time()
221221
wrapped: RequestResponse | None = None
222222
if resp is not None:
223223
try:
224-
await page.wait_for_load_state(state="domcontentloaded", timeout=180000)
224+
await page.wait_for_load_state(state="networkidle", timeout=180000)
225225
except Error:
226226
pass
227227
else:
228-
if (tim_sl := 4 - (time.time() - start)) > 0:
228+
if (tim_sl := 6 - (time.time() - start)) > 0:
229229
time.sleep(tim_sl)
230230
content = await page.content()
231231
wrapped = _create_response(request, resp, content)

uv.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)