service: Stop the timer more often

This commit is contained in:
PapaTutuWawa 2022-08-16 18:55:11 +02:00
parent 8d78c522f4
commit 4a56efc463

View File

@ -55,16 +55,21 @@ class MoxxyReconnectionPolicy extends ReconnectionPolicy {
@override @override
Future<void> reset() async { Future<void> reset() async {
_stopTimer();
await setIsReconnecting(false); await setIsReconnecting(false);
} }
@visibleForTesting void _stopTimer() {
Future<void> onTimerElapsed() async {
if (timer != null) { if (timer != null) {
timer!.cancel(); timer!.cancel();
timer = null; timer = null;
_log.finest('Destroying timer'); _log.finest('Destroying timer');
} }
}
@visibleForTesting
Future<void> onTimerElapsed() async {
_stopTimer();
_log.finest('Performing reconnect'); _log.finest('Performing reconnect');
await performReconnect!(); await performReconnect!();