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:
parent
fe637e1627
commit
c5e6a89f05
|
|
@ -81,8 +81,6 @@ class Client extends MatrixApi {
|
||||||
|
|
||||||
Set<String> supportedLoginTypes;
|
Set<String> supportedLoginTypes;
|
||||||
|
|
||||||
int sendMessageTimeoutSeconds;
|
|
||||||
|
|
||||||
bool requestHistoryOnLimitedTimeline;
|
bool requestHistoryOnLimitedTimeline;
|
||||||
|
|
||||||
final bool formatLocalpart;
|
final bool formatLocalpart;
|
||||||
|
|
@ -179,7 +177,6 @@ class Client extends MatrixApi {
|
||||||
Set<String>? roomPreviewLastEvents,
|
Set<String>? roomPreviewLastEvents,
|
||||||
this.pinUnreadRooms = false,
|
this.pinUnreadRooms = false,
|
||||||
this.pinInvitedRooms = true,
|
this.pinInvitedRooms = true,
|
||||||
this.sendMessageTimeoutSeconds = 60,
|
|
||||||
this.requestHistoryOnLimitedTimeline = false,
|
this.requestHistoryOnLimitedTimeline = false,
|
||||||
Set<String>? supportedLoginTypes,
|
Set<String>? supportedLoginTypes,
|
||||||
this.mxidLocalPartFallback = true,
|
this.mxidLocalPartFallback = true,
|
||||||
|
|
|
||||||
|
|
@ -123,7 +123,7 @@ class Event extends MatrixEvent {
|
||||||
originServerTs.millisecondsSinceEpoch;
|
originServerTs.millisecondsSinceEpoch;
|
||||||
|
|
||||||
final room = this.room;
|
final room = this.room;
|
||||||
if (age > room.client.sendMessageTimeoutSeconds * 1000) {
|
if (age > room.client.sendTimelineEventTimeout.inMilliseconds) {
|
||||||
// Update this event in database and open timelines
|
// Update this event in database and open timelines
|
||||||
final json = toJson();
|
final json = toJson();
|
||||||
json['unsigned'] ??= <String, dynamic>{};
|
json['unsigned'] ??= <String, dynamic>{};
|
||||||
|
|
|
||||||
|
|
@ -26,12 +26,14 @@ const ssssKey = 'EsT9 RzbW VhPW yqNp cC7j ViiW 5TZB LuY4 ryyv 9guN Ysmr WDPH';
|
||||||
const pickledOlmAccount =
|
const pickledOlmAccount =
|
||||||
'N2v1MkIFGcl0mQpo2OCwSopxPQJ0wnl7oe7PKiT4141AijfdTIhRu+ceXzXKy3Kr00nLqXtRv7kid6hU4a+V0rfJWLL0Y51+3Rp/ORDVnQy+SSeo6Fn4FHcXrxifJEJ0djla5u98fBcJ8BSkhIDmtXRPi5/oJAvpiYn+8zMjFHobOeZUAxYR0VfQ9JzSYBsSovoQ7uFkNks1M4EDUvHtuyg3RxViwdNxs3718fyAqQ/VSwbXsY0Nl+qQbF+nlVGHenGqk5SuNl1P6e1PzZxcR0IfXA94Xij1Ob5gDv5YH4UCn9wRMG0abZsQP0YzpDM0FLaHSCyo9i5JD/vMlhH+nZWrgAzPPCTNGYewNV8/h3c+VyJh8ZTx/fVi6Yq46Fv+27Ga2ETRZ3Qn+Oyx6dLBjnBZ9iUvIhqpe2XqaGA1PopOz8iDnaZitw';
|
'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(
|
final client = Client(
|
||||||
'testclient',
|
'testclient',
|
||||||
httpClient: FakeMatrixApi(),
|
httpClient: FakeMatrixApi(),
|
||||||
databaseBuilder: getDatabase,
|
databaseBuilder: getDatabase,
|
||||||
onSoftLogout: (client) => client.refreshAccessToken(),
|
onSoftLogout: (client) => client.refreshAccessToken(),
|
||||||
|
sendTimelineEventTimeout: sendTimelineEventTimeout,
|
||||||
);
|
);
|
||||||
FakeMatrixApi.client = client;
|
FakeMatrixApi.client = client;
|
||||||
await client.checkHomeserver(Uri.parse('https://fakeServer.notExisting'),
|
await client.checkHomeserver(Uri.parse('https://fakeServer.notExisting'),
|
||||||
|
|
|
||||||
|
|
@ -32,8 +32,9 @@ void main() {
|
||||||
late Client client;
|
late Client client;
|
||||||
|
|
||||||
setUp(() async {
|
setUp(() async {
|
||||||
client = await getClient();
|
client = await getClient(
|
||||||
client.sendMessageTimeoutSeconds = 5;
|
sendTimelineEventTimeout: const Duration(seconds: 5),
|
||||||
|
);
|
||||||
|
|
||||||
await client.abortSync();
|
await client.abortSync();
|
||||||
insertList.clear();
|
insertList.clear();
|
||||||
|
|
|
||||||
|
|
@ -62,8 +62,9 @@ void main() {
|
||||||
late Room room;
|
late Room room;
|
||||||
late Timeline timeline;
|
late Timeline timeline;
|
||||||
setUp(() async {
|
setUp(() async {
|
||||||
client = await getClient();
|
client = await getClient(
|
||||||
client.sendMessageTimeoutSeconds = 5;
|
sendTimelineEventTimeout: const Duration(seconds: 5),
|
||||||
|
);
|
||||||
|
|
||||||
room = Room(
|
room = Room(
|
||||||
id: roomID, client: client, prev_batch: 't123', roomAccountData: {});
|
id: roomID, client: client, prev_batch: 't123', roomAccountData: {});
|
||||||
|
|
|
||||||
|
|
@ -64,8 +64,9 @@ void main() {
|
||||||
late Room room;
|
late Room room;
|
||||||
late Timeline timeline;
|
late Timeline timeline;
|
||||||
setUp(() async {
|
setUp(() async {
|
||||||
client = await getClient();
|
client = await getClient(
|
||||||
client.sendMessageTimeoutSeconds = 5;
|
sendTimelineEventTimeout: const Duration(seconds: 5),
|
||||||
|
);
|
||||||
|
|
||||||
final poison = Random().nextInt(2 ^ 32);
|
final poison = Random().nextInt(2 ^ 32);
|
||||||
currentPoison = poison;
|
currentPoison = poison;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue