Split connect/read timeouts and add an overall deadline to /authenticate
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 45/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Ambito
- api, authentication, backend
Direzione di ricerca
Start after #184 merges, then read _fetch_new_client_with_csrf_token in app/pesu.py and PESUAcademy.authenticate, along with the timeout guidance in CONTRIBUTING.md. Add the configured phase timeouts, request deadline handling, client-close coverage, and the README note; verify the listed timeout, cancellation, deadline, and within-deadline tests plus the live suite.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
🔄 Updated for v5.0.0 (2026-10-08). A login is now at most two upstream calls (
loginandprofile_fetch) on one client created inauthenticate, with no CSRF fetch and no redirects followed (#241). The worst case is about 20 s rather than 30 s, and the background and the steps below are updated to match. The proposal itself is unchanged.
⚠️ PES University students only. This change sits in the login path and has to be tested end to end against PESU Academy with real PESU credentials (see "Tests that need credentials" in
CONTRIBUTING.md). Run the whole suite with your credentials in.envand paste the summary line into your PR. Every run makes real logins to PESU Academy, so run it when you need it, not in a loop.
Summary
Every upstream call uses a single 10-second timeout for every phase, and there's no limit on a whole request. A login with profile: true makes two calls, so a caller can wait about 20 seconds before getting an answer. Many HTTP clients and proxies give up well before that. Use separate connect and read timeouts, and add one overall deadline per /authenticate request.
Background
httpx2.AsyncClient(timeout=UPSTREAM_TIMEOUT_SECONDS)inPESUAcademy.authenticate(app/pesu.py), withUPSTREAM_TIMEOUT_SECONDS = 10.0. A bare number means connect, read, write and pool are each 10 s.- A login makes a
loginPOST and, when the profile is requested, aprofile_fetchPOST, both on the same client. Redirects are not followed. - A connect timeout should be short: if the TCP/TLS connection can't be made in a few seconds, it won't be. A read timeout needs to be longer, because PESU Academy can be slow to answer: in the 5.0.0 benchmarks the login took about 2.5 s on average and the profile call about 0.9 s.
pesu_auth_upstream_latency_seconds{operation}in/metricshas the real numbers. Ask a maintainer for production values if/metricsis token-protected.
Proposed change
- Per-phase timeouts:
httpx2.Timeout(read=READ_TIMEOUT, connect=CONNECT_TIMEOUT)(for example connect 5 s, read 10 s), defined as module constants with a comment saying where the numbers came from (the latency metrics). Note thathttpx2.Timeout(10.0, connect=5.0)sets connect to 5 s and everything else to 10 s. - Overall deadline: wrap the work in
PESUAcademy.authenticateinasync with asyncio.timeout(REQUEST_DEADLINE):(for example 20 s).- When it fires,
asyncio.timeoutraisesTimeoutError. Convert that to the 504 exception from #184, with the same message. - The client must still be closed; the existing
finallyhandles this, but add a test. - Everything a login does happens inside
authenticate(5.0.0 removed the background prefetch), so the deadline covers all of it.
- When it fires,
- Document the timeouts in the README (a short "Timeouts" note under
/authenticate) so callers can set their own client timeout above the deadline.
Depends on #184, which adds the 504 exception. Start after it merges, or coordinate with its assignee.
Tests
- The client is built with the configured
httpx2.Timeout(assert on the constructor arguments). - A request whose upstream calls together exceed the deadline returns 504, and the client is closed (patch the calls with
asyncio.sleepand a small deadline). - A request within the deadline is unaffected.
- Cancellation from outside still propagates as
CancelledError, not 504. - The live suite passes.
Acceptance criteria
- Connect and read timeouts are separate named constants with a documented rationale
- No
/authenticaterequest runs longer than the deadline (plus a small margin) - Deadline expiry is a 504 in the standard error body, documented in the README
How to contribute
- Wait until you're assigned. Comment to ask for this issue, then wait for a maintainer to assign it to you before writing any code. PRs for unassigned issues are closed without review.
- Read
CONTRIBUTING.mdfirst. It covers forking, setting up withuv, and running the tests. - Branch from
devin your fork, and open the PR againstdevwith a Conventional Commit title andCloses #185in the description. - Bump the minor version in
pyproject.tomland runuv lock(CI checks this).uv run pre-commit run --all-filesmust pass, and coverage must stay at 100%. - Update the README,
app/docs/and comments in the same PR as the behaviour they describe. - Never log, print, store or echo a password or token, including in tests, PR descriptions and screenshots.
- Lingua principale
- Python
- Stelle
- 22
- Fork
- 29
- Merge medio
- 22h 1m
- PR unite (30g)
- 20
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di pesu-dev/auth
-
Check the README for dead links and fix the misleading Docker Hub badgeForse di nuovo libera @knownshah l’ha presa 17 giorni fa e non c’è nessuna pull request aperta. Apertadocumentation good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
pesu-dev/auth#220 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Run the same checks locally and in CI: pre-commit hooks in CI, and hooks that match CIForse già presa @achyu-dev l’ha presa 1 giorno fa. Apertabug tests and ci/cd
pesu-dev/auth#250 · 2 assegnatari ·
I maintainer di solito rispondono entro 1 giorno
-
bug documentation enhancement
Difficoltà 3/5 1-2 giorni Idoneità per principianti 54/100
I maintainer di solito rispondono entro 1 giorno
-
Commit SHA should be used instead of tag git based deployForse già presa @aditeyabaral l’ha presa 11 giorni fa. Apertabug
pesu-dev/auth#236 · 2 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
Private Functions in `app.py` needs to be in separate fileForse già presa @aditeyabaral l’ha presa 11 giorni fa. Apertaapi enhancement
pesu-dev/auth#235 · 1 commento · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di pesu-dev/auth
Issue simili
-
md/asciidoc/csv: an explicit `encoding="utf-8"` keeps a leading BOM, the auto-detect path drops itAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
docling-project/docling#4846 ·
I maintainer di solito rispondono entro 1 giorno
-
area/sessions comp/dashboard comp/desktop comp/gateway comp/tui duplicate P2 sweeper:risk-session-state type/bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
NousResearch/hermes-agent#138914 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
bot-triaged module: activation checkpointing module: inductor oncall: pt2 triaged
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
I maintainer di solito rispondono entro 1 giorno
-
[oblt-aw][autodoc] Update PR Actions Detective E2E prerequisites and fix dashboard-format table typoApertadocumentation
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
elastic/oblt-aw#2382 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
I maintainer di solito rispondono entro 1 giorno