Stable-Diffusion-Android icon indicating copy to clipboard operation
Stable-Diffusion-Android copied to clipboard

Make HTTP request timeout configurable (hardcoded 120 s breaks slow self-hosted backends)

Open wiz0floyd opened this issue 2 weeks ago • 1 comments

Problem

All HTTP requests share a hardcoded 120 s timeout (connectTimeoutMillis, requestTimeoutMillis, socketTimeoutMillis) in network/src/commonMain/kotlin/com/shifthackz/aisdv1/network/client/HttpClientFactory.kt:

private const val DEFAULT_TIMEOUT_MILLIS = 120_000L

Against slow self-hosted backends (e.g. an A1111-compatible stable-diffusion.cpp sd-server with CPU offload, large FLUX-class models, or a server that cold-loads the model on the first request), a single txt2img/img2img call often takes longer than 2 minutes. SDAI then aborts the request even though the server is still generating and later returns a valid image. There is currently no setting to change this.

Proposal

Add a user setting (e.g. under the server/connection settings) for the generation request timeout, with 120 s as the default and an option for "no limit". Applied to requestTimeoutMillis and socketTimeoutMillis; connect timeout can stay short.

I'm happy to send a PR for this.

wiz0floyd avatar Nov 13 '26 23:11 wiz0floyd

Addressed in #734, merged into develop. Thanks @wiz0floyd for reporting the issue and contributing #733.

  1. Configurable generation request and socket timeouts for all eight network AI providers: 2 minutes (default), 5, 10, 30 minutes, or No limit.
  2. Separate connection timeout with the same default and options on Android. This setting is hidden on iOS because the current networking engine does not support it independently.
  3. Timeout settings are hidden for local providers, with translations for all six supported languages.

This feature will be included in the next release.

ShiftHackZ avatar Nov 14 '26 13:11 ShiftHackZ