From b90c5d43830042dc700793dd5ca0870d08a9e01a Mon Sep 17 00:00:00 2001 From: Christian Pauly Date: Wed, 23 Jun 2021 11:40:12 +0200 Subject: [PATCH] chore: Make connection header less chatty --- lib/widgets/connection_status_header.dart | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/widgets/connection_status_header.dart b/lib/widgets/connection_status_header.dart index c30037ae..639380cb 100644 --- a/lib/widgets/connection_status_header.dart +++ b/lib/widgets/connection_status_header.dart @@ -17,7 +17,7 @@ class _ConnectionStatusHeaderState extends State { bool get _connected => DateTime.now().millisecondsSinceEpoch - _lastSyncReceived.millisecondsSinceEpoch < - 1000 * 30; + (Matrix.of(context).client.syncTimeoutSec + 2) * 1000; static DateTime _lastSyncReceived = DateTime(0); SyncStatusUpdate _status = SyncStatusUpdate(SyncStatus.waitingForResponse); @@ -33,7 +33,9 @@ class _ConnectionStatusHeaderState extends State { _onSyncSub ??= Matrix.of(context).client.onSyncStatus.stream.listen( (status) => setState( () { - if (status.status == SyncStatus.finished) { + if ((status.status == SyncStatus.processing && + Matrix.of(context).client.prevBatch != null) || + status.status == SyncStatus.finished) { _lastSyncReceived = DateTime.now(); } _status = status;