Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Async requests block the caller while acquiring a bearer token

Aperta
#1,175 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

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
30/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
java, kotlin

Direzione di ricerca

Start at prepareAsync(), which calls prepare() before wrapping the result in CompletedFuture.completableFuture(...), and follow securityHeaders() to the credential.token() call that invokes the Supplier from BearerTokenCredential.create. The fix needs a decision on the API shape for an async token supplier before any code, so check with maintainers first. Done means an async request with a slow supplier returns to the caller before the supplier finishes, covered by a test with a deliberately delayed supplier.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Problem

An async client configured with BearerTokenCredential.create(Supplier<String>) always invokes the supplier synchronously while preparing the request. If token acquisition takes time, the async request method blocks before returning a completable future.

prepareAsync() evaluates prepare() before wrapping it in a CompletedFuture.completableFuture(...). During preparation, securityHeaders() calls credential.token() which invokes the supplier.

Expected behavior

Async request methods should return without waiting for token acquisition on the caller's thread

Suggested Fix

Provide a native path to configure an async token fetch supplier for BearerTokenCredential. On async calls configured with a synchronous supplier, offload token fetch to a worker thread to avoid blocking the caller.

Lingua principale
Kotlin
Stelle
1.5k
Fork
268
Merge medio
11h 26m
PR unite (30g)
151

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di openai/openai-java

Tutte le issue di openai/openai-java

Issue simili

Altre issue su Kotlin

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.