From d00d0ad9c5b9c04e097f8f37987138ab0242f4c6 Mon Sep 17 00:00:00 2001 From: Rasyid Ridho <34451369+rasyid7@users.noreply.github.com> Date: Wed, 14 Aug 2024 21:44:35 +0700 Subject: [PATCH] Fix Android Parallel/Shards Race Condition (#1867) https://github.com/mobile-dev-inc/maestro/issues/1853 --- .../src/main/java/maestro/cli/session/MaestroSessionManager.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/maestro-cli/src/main/java/maestro/cli/session/MaestroSessionManager.kt b/maestro-cli/src/main/java/maestro/cli/session/MaestroSessionManager.kt index 75f09403ad..3b04d0a466 100644 --- a/maestro-cli/src/main/java/maestro/cli/session/MaestroSessionManager.kt +++ b/maestro-cli/src/main/java/maestro/cli/session/MaestroSessionManager.kt @@ -74,6 +74,7 @@ object MaestroSessionManager { val heartbeatFuture = executor.scheduleAtFixedRate( { try { + Thread.sleep(1000) // Add a 1-second delay here for fixing race condition SessionStore.heartbeat(sessionId, selectedDevice.platform) } catch (e: Exception) { logger.error("Failed to record heartbeat", e)