Files
plezy/lib/utils/connection_constants.dart
T

26 lines
1.2 KiB
Dart
Raw Normal View History

2026-01-28 04:23:27 +01:00
/// Centralized connection timeout constants used across the app.
class ConnectionTimeouts {
/// Timeout for probing a cached/preferred endpoint before falling back to
/// the full candidate race (used in [PlexServer.findBestWorkingConnection]).
static const preferredEndpointProbe = Duration(milliseconds: 1500);
2026-01-28 04:23:27 +01:00
/// Timeout for the connection race where all candidates are tested in
/// parallel (used in [PlexServer.findBestWorkingConnection]).
static const connectionRace = Duration(seconds: 2);
2026-01-28 04:23:27 +01:00
2026-04-08 00:43:08 +02:00
/// HTTP connect timeout for individual HTTP requests to a Plex server.
2026-01-28 04:23:27 +01:00
static const connect = Duration(seconds: 10);
/// Per-server connection budget: preferred probe + race + HTTPS upgrade attempt + 1s buffer.
static const perServerConnect = Duration(milliseconds: 1500 + 2000 + 2000 + 1000);
2026-01-28 04:23:27 +01:00
2026-04-08 00:43:08 +02:00
/// HTTP receive timeout for streaming/large responses from a Plex server.
2026-01-28 04:23:27 +01:00
static const receive = Duration(seconds: 120);
2026-02-23 14:08:52 +01:00
2026-04-08 00:43:08 +02:00
/// HTTP connect timeout for plex.tv / clients.plex.tv API requests.
2026-02-23 14:08:52 +01:00
static const plexTvConnect = Duration(seconds: 5);
2026-04-08 00:43:08 +02:00
/// HTTP receive timeout for plex.tv / clients.plex.tv API responses.
2026-02-23 14:08:52 +01:00
static const plexTvReceive = Duration(seconds: 10);
2026-01-28 04:23:27 +01:00
}