Skip to content

Reutilizar un solo OkHttpClient entre llamadas - #16

Open
PanchoSimpli wants to merge 1 commit into
SimpliRoute:masterfrom
PanchoSimpli:FIX-okhttp_shared_client
Open

PanchoSimpli wants to merge 1 commit into
SimpliRoute:masterfrom
PanchoSimpli:FIX-okhttp_shared_client

Conversation

@PanchoSimpli

@PanchoSimpli PanchoSimpli commented Oct 23, 2026 •

Copy link
Copy Markdown

OSRMClient reutiliza un único OkHttpClient en vez de crear uno por llamada. La configuración es la misma (timeouts de lectura y escritura de 900 s); no cambian la URL, los parámetros, el parseo ni el manejo de errores.

Cada OkHttpClient tiene su propio pool de conexiones y su hilo de limpieza. Si se crea uno por llamada, esos recursos no se reutilizan y se acumulan.

Test: OSRMClientTest.callsReuseTheSameHttpClientAndConnection.

getCostMatrices construía un OkHttpClient nuevo en cada llamada, cada uno con
su propio pool de conexiones e hilo de limpieza. Ahora se usa un cliente
estático con los mismos timeouts (lectura/escritura 900 s).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0141agzSNA5p276AxeJKueTu
@PanchoSimpli PanchoSimpli changed the title FIX: compartir un solo OkHttpClient entre llamadas a OSRM Reutilizar un solo OkHttpClient entre llamadas Oct 23, 2026
@PanchoSimpli
PanchoSimpli marked this pull request as ready for review October 23, 2026 19:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants