Skip to content

Commit 1f051f3

Browse files
authored
fix: add 15-second timeout to all HTTP requests (#2777)
Adds a default request timeout in LichessClient.send() to prevent requests from hanging indefinitely, which can cause screens to stay stuck in loading state.
1 parent b4f770a commit 1f051f3

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/src/network/http.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,8 @@ class _RegisterCallbackClient extends BaseClient {
332332
class LichessClient implements Client {
333333
LichessClient(this._inner, this._ref);
334334

335+
static const defaultRequestTimeout = Duration(seconds: 15);
336+
335337
final Ref _ref;
336338
final Client _inner;
337339

@@ -353,7 +355,7 @@ class LichessClient implements Client {
353355
_logger.info('${request.method} ${request.url} ${request.headers['User-Agent']}');
354356

355357
try {
356-
final response = await _inner.send(request);
358+
final response = await _inner.send(request).timeout(defaultRequestTimeout);
357359

358360
_logIfError(response);
359361

0 commit comments

Comments
 (0)