refactor: Make network request timeout

configurable
This commit is contained in:
Krille 2024-05-21 08:29:36 +02:00
parent c5e6a89f05
commit 4d60c8f023
No known key found for this signature in database
GPG Key ID: E067ECD60F1A0652
1 changed files with 4 additions and 1 deletions

View File

@ -177,6 +177,8 @@ class Client extends MatrixApi {
Set<String>? roomPreviewLastEvents, Set<String>? roomPreviewLastEvents,
this.pinUnreadRooms = false, this.pinUnreadRooms = false,
this.pinInvitedRooms = true, this.pinInvitedRooms = true,
@Deprecated('Use [sendTimelineEventTimeout] instead.')
int? sendMessageTimeoutSeconds,
this.requestHistoryOnLimitedTimeline = false, this.requestHistoryOnLimitedTimeline = false,
Set<String>? supportedLoginTypes, Set<String>? supportedLoginTypes,
this.mxidLocalPartFallback = true, this.mxidLocalPartFallback = true,
@ -185,6 +187,7 @@ class Client extends MatrixApi {
NativeImplementations nativeImplementations = NativeImplementations.dummy, NativeImplementations nativeImplementations = NativeImplementations.dummy,
Level? logLevel, Level? logLevel,
Filter? syncFilter, Filter? syncFilter,
Duration defaultNetworkRequestTimeout = const Duration(seconds: 35),
this.sendTimelineEventTimeout = const Duration(minutes: 1), this.sendTimelineEventTimeout = const Duration(minutes: 1),
this.customImageResizer, this.customImageResizer,
this.shareKeysWithUnverifiedDevices = true, this.shareKeysWithUnverifiedDevices = true,
@ -218,7 +221,7 @@ class Client extends MatrixApi {
: nativeImplementations, : nativeImplementations,
super( super(
httpClient: FixedTimeoutHttpClient( httpClient: FixedTimeoutHttpClient(
httpClient ?? http.Client(), Duration(seconds: 35))) { httpClient ?? http.Client(), defaultNetworkRequestTimeout)) {
if (logLevel != null) Logs().level = logLevel; if (logLevel != null) Logs().level = logLevel;
importantStateEvents.addAll([ importantStateEvents.addAll([
EventTypes.RoomName, EventTypes.RoomName,