fixed stalled requests after app resume

This commit is contained in:
2026-09-24 22:33:00 +02:00
parent 4f31e68456
commit de866b12b4
5 changed files with 34 additions and 7 deletions
+5 -1
View File
@@ -12,6 +12,10 @@ import '../nextcloud_ocs.dart';
import 'talk_error.dart';
abstract class TalkApi<T extends ApiResponse?> {
// package:http has no timeout of its own; a request stuck on a dead
// connection (e.g. one started right before a suspend) would spin forever.
static const Duration _timeout = Duration(seconds: 30);
String path;
ApiParams? body;
Map<String, String>? headers;
@@ -35,7 +39,7 @@ abstract class TalkApi<T extends ApiResponse?> {
final data = await sendGuarded(
'Talk $endpoint',
() => request(endpoint, body, mergedHeaders),
() => request(endpoint, body, mergedHeaders)?.timeout(_timeout),
);
if (data == null) {
throw const NetworkException(