From 583be5ece79711b85e3f5ba301282ac7601ff5d1 Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Mon, 7 Oct 2024 19:03:33 +0200 Subject: [PATCH] fix: by default don't uplaod new keys in our tests This reduces CPU load of the uploadKeys callback by a lot, since we don't upload new keys on every empty sync in the tests. --- lib/fake_matrix_api.dart | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/fake_matrix_api.dart b/lib/fake_matrix_api.dart index d6951ea1..8d96a4b3 100644 --- a/lib/fake_matrix_api.dart +++ b/lib/fake_matrix_api.dart @@ -204,7 +204,13 @@ class FakeMatrixApi extends BaseClient { await Future.delayed(Duration(milliseconds: 50)); } res = { - 'next_batch': DateTime.now().millisecondsSinceEpoch.toString(), + // So that it is clear which sync we are processing prefix it with 'empty_' + 'next_batch': 'empty_${DateTime.now().millisecondsSinceEpoch}', + // ensure we don't generate new keys for no reason + 'device_one_time_keys_count': { + 'curve25519': 10, + 'signed_curve25519': 100 + }, }; } else if (method == 'PUT' && _client != null && @@ -1038,7 +1044,7 @@ class FakeMatrixApi extends BaseClient { '@bob:example.com', ], }, - 'device_one_time_keys_count': {'curve25519': 10, 'signed_curve25519': 20}, + 'device_one_time_keys_count': {'curve25519': 10, 'signed_curve25519': 100}, }; static Map archiveSyncResponse = {