From ba96ae35e061a79fdba5103ece4e649117d1b8a4 Mon Sep 17 00:00:00 2001 From: Naveed Jooma Date: Wed, 13 Nov 2024 13:02:17 -0500 Subject: [PATCH] Shortcircuit if sessions disabled (#297) --- lib/src/robot/sessions_client.dart | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/src/robot/sessions_client.dart b/lib/src/robot/sessions_client.dart index e6956cdaac..7e480847c8 100644 --- a/lib/src/robot/sessions_client.dart +++ b/lib/src/robot/sessions_client.dart @@ -81,6 +81,7 @@ class SessionsClient implements ResourceRPCClient { /// Reset the current session and re-obtain metadata void reset() { + if (!_enabled) return; _logger.d('Resetting current session with ID: $_currentId'); _currentId = ''; _supported = null; @@ -90,6 +91,7 @@ class SessionsClient implements ResourceRPCClient { /// Stop the session client and heartbeat tasks void stop() { + if (!_enabled) return; _logger.d('Stopping SessionClient'); _currentId = ''; _supported = null; @@ -101,6 +103,7 @@ class SessionsClient implements ResourceRPCClient { } Future _heartbeatTask() async { + if (!_enabled) return; while (_supported == true) { await _heartbeatTick(); await Future.delayed(_heartbeatInterval); @@ -108,6 +111,7 @@ class SessionsClient implements ResourceRPCClient { } Future _heartbeatTick() async { + if (!_enabled) return; if (_supported == false) return; final request = SendSessionHeartbeatRequest()..id = _currentId;