refactor: Combine sendMessageTimeoutSeconds and sendTimelineEventTimeout

Those timeouts were basically the same
and both had the same default value
1 minute. I guess it was just a
mistake to duplicate this.
This commit is contained in:
krille-chan 2024-05-20 16:57:55 +02:00
parent fe637e1627
commit c5e6a89f05
No known key found for this signature in database
6 changed files with 13 additions and 11 deletions

View File

@ -81,8 +81,6 @@ class Client extends MatrixApi {
Set<String> supportedLoginTypes;
int sendMessageTimeoutSeconds;
bool requestHistoryOnLimitedTimeline;
final bool formatLocalpart;
@ -179,7 +177,6 @@ class Client extends MatrixApi {
Set<String>? roomPreviewLastEvents,
this.pinUnreadRooms = false,
this.pinInvitedRooms = true,
this.sendMessageTimeoutSeconds = 60,
this.requestHistoryOnLimitedTimeline = false,
Set<String>? supportedLoginTypes,
this.mxidLocalPartFallback = true,

View File

@ -123,7 +123,7 @@ class Event extends MatrixEvent {
originServerTs.millisecondsSinceEpoch;
final room = this.room;
if (age > room.client.sendMessageTimeoutSeconds * 1000) {
if (age > room.client.sendTimelineEventTimeout.inMilliseconds) {
// Update this event in database and open timelines
final json = toJson();
json['unsigned'] ??= <String, dynamic>{};

View File

@ -26,12 +26,14 @@ const ssssKey = 'EsT9 RzbW VhPW yqNp cC7j ViiW 5TZB LuY4 ryyv 9guN Ysmr WDPH';
const pickledOlmAccount =
'N2v1MkIFGcl0mQpo2OCwSopxPQJ0wnl7oe7PKiT4141AijfdTIhRu+ceXzXKy3Kr00nLqXtRv7kid6hU4a+V0rfJWLL0Y51+3Rp/ORDVnQy+SSeo6Fn4FHcXrxifJEJ0djla5u98fBcJ8BSkhIDmtXRPi5/oJAvpiYn+8zMjFHobOeZUAxYR0VfQ9JzSYBsSovoQ7uFkNks1M4EDUvHtuyg3RxViwdNxs3718fyAqQ/VSwbXsY0Nl+qQbF+nlVGHenGqk5SuNl1P6e1PzZxcR0IfXA94Xij1Ob5gDv5YH4UCn9wRMG0abZsQP0YzpDM0FLaHSCyo9i5JD/vMlhH+nZWrgAzPPCTNGYewNV8/h3c+VyJh8ZTx/fVi6Yq46Fv+27Ga2ETRZ3Qn+Oyx6dLBjnBZ9iUvIhqpe2XqaGA1PopOz8iDnaZitw';
Future<Client> getClient() async {
Future<Client> getClient(
{Duration sendTimelineEventTimeout = const Duration(minutes: 1)}) async {
final client = Client(
'testclient',
httpClient: FakeMatrixApi(),
databaseBuilder: getDatabase,
onSoftLogout: (client) => client.refreshAccessToken(),
sendTimelineEventTimeout: sendTimelineEventTimeout,
);
FakeMatrixApi.client = client;
await client.checkHomeserver(Uri.parse('https://fakeServer.notExisting'),

View File

@ -32,8 +32,9 @@ void main() {
late Client client;
setUp(() async {
client = await getClient();
client.sendMessageTimeoutSeconds = 5;
client = await getClient(
sendTimelineEventTimeout: const Duration(seconds: 5),
);
await client.abortSync();
insertList.clear();

View File

@ -62,8 +62,9 @@ void main() {
late Room room;
late Timeline timeline;
setUp(() async {
client = await getClient();
client.sendMessageTimeoutSeconds = 5;
client = await getClient(
sendTimelineEventTimeout: const Duration(seconds: 5),
);
room = Room(
id: roomID, client: client, prev_batch: 't123', roomAccountData: {});

View File

@ -64,8 +64,9 @@ void main() {
late Room room;
late Timeline timeline;
setUp(() async {
client = await getClient();
client.sendMessageTimeoutSeconds = 5;
client = await getClient(
sendTimelineEventTimeout: const Duration(seconds: 5),
);
final poison = Random().nextInt(2 ^ 32);
currentPoison = poison;