Give optional GitHub lookups a short timeout so a bad network does not stall linking
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 85/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- github, javascript, node.js
- Ambito
- backend, networking
Direzione di ricerca
Leggi src/github-http.cjs per vedere come vengono usati REQUEST_TIMEOUT_MS e opts.setTimeout, poi segui isPullRequest in src/github-prs.js. Inizia da tests/unit/github-prs.test.cjs, che già inietta i timeout. Il lavoro è terminato quando il controllo della pull request si interrompe dopo circa 3 secondi, mentre le altre richieste a GitHub mantengono il timeout attuale.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
What problem does this address?
Some GitHub lookups only add a nice-to-have, but they still wait the full 15-second request timeout when the network is connected and GitHub can't be reached. Think of a Contributor Day Wi-Fi with a sign-in page, or a proxy that drops requests.
The first one is the pull-request check on the Issue field (#736). Linking an issue on a Gutenberg site asks GitHub whether the number is a pull request first. If GitHub doesn't answer, the link still goes ahead, but only after up to 15 seconds of waiting.
What is your proposed solution?
Give lookups like this a short timeout, around 3 seconds, so the app gives up quickly and carries on as if the answer were "no".
Implementation notes
REQUEST_TIMEOUT_MSinsrc/github-http.cjsis a single constant for every request.httpRequesttakesopts.setTimeout(for tests) but has no per-call timeout. Addingopts.timeoutMs, with the constant as the default, would leave every existing caller unchanged.isPullRequestinsrc/github-prs.js(from #736) would pass the short timeout. It already treats any failure as "not a pull request", so a timeout needs no new handling.- Pre-checking
net.isOnline()(main) ornavigator.onLine(renderer) doesn't solve this. Both report whether the machine has a network connection, not whether GitHub is reachable, so they read as online in exactly the slow case. With no network at all, Chromium already fails the request almost at once. - Leave the timeout as it is for requests whose answer the user is waiting on, like opening a pull request, signing in, and the linked pull request list. A slow network there should fail with "Could not reach GitHub", not be cut short.
- The unit tests in
tests/unit/github-prs.test.cjsalready drive timeouts with an injectedsetTimeout, so the short timeout can be tested without the network.
- Lingua principale
- JavaScript
- Stelle
- 66
- Fork
- 20
- Merge medio
- 1g 18h
- PR unite (30g)
- 22
Preparare l'ambiente
- Nessun Dockerfile né 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 WordPress/contributor-toolkit
-
documentation
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
WordPress/contributor-toolkit#762 ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 64/100
WordPress/contributor-toolkit#746 ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
WordPress/contributor-toolkit#741 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
WordPress/contributor-toolkit#726 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
WordPress/contributor-toolkit#721 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di WordPress/contributor-toolkit
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
pedroapfilho/localveil#120 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
ImpactMojo/ImpactMojo#1385 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno