Green Invoice access token is fetched on every request; client fires per-row request bursts
I maintainer di solito rispondono entro 2 giorni
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 35/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- graphql, typescript
- Ambito
- backend, databases, performance
Direzione di ricerca
Start with packages/server/src/modules/app-providers/green-invoice-client.ts and packages/green-invoice-graphql/src/index.ts to trace token initialization and provider scope. For the request bursts, inspect Hive usage data for the reported minute and trace the matching operation to its page load; packages/server/src/modules/app-providers/tenant-db-client.ts shows the sequential query behavior. Done means one token request for two operations within an hour, with a fetch-injection test, and one request per page load instead of one per row.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Part of #4869.
1. A new Green Invoice token on every request
GreenInvoiceClientProviderisScope.Operation(packages/server/src/modules/app-providers/green-invoice-client.ts:25).- So every operation that touches Green Invoice calls
init()→obtainAccessToken()(packages/green-invoice-graphql/src/index.ts:4-29), an extra OAuth round trip each time. - On 2026-10-09, 10 one-hour tokens were minted in 36 minutes to serve 19 document fetches.
Fix:
- Add an app-level (singleton) token cache keyed by the tenant's credentials ID.
- Reuse a token until
exp − 5 min. - Refresh with a single in-flight request at a time, and invalidate the cached token on a 401.
- The operation-scoped provider reads its token from this cache.
2. The client fires per-row request bursts
- At 07:43:07 UTC the client sent 74 GraphQL requests within one second, and 100 in that minute.
- Each request holds its own pooled connection for its whole lifetime (pool max 20).
- Each request also runs its queries one at a time on that connection (
packages/server/src/modules/app-providers/tenant-db-client.ts:315). That is also why report requests take 8–9 s. - So a burst like this can saturate the pool on its own.
Fix: find the operation in Hive usage data for that minute. Then batch it into one query, or into a field on the parent list that a DataLoader can serve.
3. Expired Auth0 tokens
Tracked in #4490. For context:
- Tokens arrived up to 31 minutes after their
exp. - Bursts of up to 7 parallel requests failed together before the client refreshed (08:28:18 and 08:34:12 UTC).
Acceptance
- Two Green Invoice operations within an hour make a single token request. Covered by a test that injects
fetch. - The source of the burst is identified, and its page load issues one request instead of one per row.
- Lingua principale
- TypeScript
- Stelle
- 30
- Fork
- 9
- Merge medio
- 1g 13h
- PR unite (30g)
- 198
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
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 Urigo/accounter-fullstack
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
Urigo/accounter-fullstack#4834 ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
Urigo/accounter-fullstack#4604 ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
Urigo/accounter-fullstack#4580 ·
I maintainer di solito rispondono entro 2 giorni
-
Document PG18 migration conventions: NOT NULL NOT VALID, and generated columns default to VIRTUALAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
Urigo/accounter-fullstack#4366 ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 50/100
Urigo/accounter-fullstack#4872 ·
I maintainer di solito rispondono entro 2 giorni
Tutte le issue di Urigo/accounter-fullstack
Issue simili
-
Remove unused dependenciesForse già presa @alastair-smith l’ha presa oggi. Apertachore other
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
alastair-smith/card-games#384 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
code-yeongyu/senpi#5571 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
nexu-io/open-design#9262 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
friction
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
kentcdodds/kody#4753 ·
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 62/100
lingdojo/kana-dojo#33508 · 1 commento · 5 reazioni ·
I maintainer di solito rispondono entro 1 giorno