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
Future<void> reset() async {
_stopTimer();
await setIsReconnecting(false);
}
@visibleForTesting
Future<void> onTimerElapsed() async {
void _stopTimer() {
if (timer != null) {
timer!.cancel();
timer = null;
_log.finest('Destroying timer');
}
}
@visibleForTesting
Future<void> onTimerElapsed() async {
_stopTimer();
_log.finest('Performing reconnect');
await performReconnect!();