fix: Start-up time waits for first sync

This commit is contained in:
Krille Fear 2021-09-20 11:52:02 +02:00
parent 457c1af4f9
commit d38da1f91a
3 changed files with 21 additions and 10 deletions

View File

@ -32,12 +32,18 @@ abstract class ClientManager {
}
if (clientNames.isEmpty) clientNames.add(PlatformInfos.clientName);
final clients = clientNames.map(createClient).toList();
final start = DateTime.now();
await Future.wait(clients.map((client) => client
.init()
.init(waitForFirstSync: false)
.catchError((e, s) => Logs().e('Unable to initialize client', e, s))));
final end = DateTime.now();
print(
'We needed: ${end.millisecondsSinceEpoch - start.millisecondsSinceEpoch} milliseconds');
if (clients.length > 1 && clients.any((c) => !c.isLogged())) {
final loggedOutClients = clients.where((c) => !c.isLogged()).toList();
for (final client in loggedOutClients) {
Logs().w(
'Multi account is enabled but client ${client.userID} is not logged in. Removing...');
clientNames.remove(client.clientName);
clients.remove(client);
}

View File

@ -742,10 +742,12 @@ packages:
matrix:
dependency: "direct main"
description:
name: matrix
url: "https://pub.dartlang.org"
source: hosted
version: "0.5.3"
path: "."
ref: "krille/init-configurable"
resolved-ref: b3c6b5f637ed7f4547f005e5e64670c49366e73d
url: "https://gitlab.com/famedly/company/frontend/famedlysdk.git"
source: git
version: "0.5.4"
matrix_api_lite:
dependency: transitive
description:
@ -964,7 +966,7 @@ packages:
name: petitparser
url: "https://pub.dartlang.org"
source: hosted
version: "4.3.0"
version: "4.1.0"
pin_code_text_field:
dependency: "direct main"
description:
@ -1118,7 +1120,7 @@ packages:
name: sentry
url: "https://pub.dartlang.org"
source: hosted
version: "6.0.0"
version: "6.0.1"
share:
dependency: "direct main"
description:
@ -1613,7 +1615,7 @@ packages:
name: xml
url: "https://pub.dartlang.org"
source: hosted
version: "5.3.0"
version: "5.1.2"
yaml:
dependency: transitive
description:
@ -1622,5 +1624,5 @@ packages:
source: hosted
version: "3.1.0"
sdks:
dart: ">=2.14.0 <3.0.0"
dart: ">=2.13.0 <3.0.0"
flutter: ">=2.2.0"

View File

@ -49,7 +49,10 @@ dependencies:
intl: any
localstorage: ^4.0.0+1
lottie: ^1.1.0
matrix: ^0.5.3
matrix:
git:
url: https://gitlab.com/famedly/company/frontend/famedlysdk.git
ref: krille/init-configurable
matrix_link_text: ^1.0.2
native_imaging:
git: https://gitlab.com/famedly/libraries/native_imaging.git