From 9f72815e73413c505af56f92af655569bfb801a5 Mon Sep 17 00:00:00 2001 From: Jamie Lynch Date: Mon, 13 Nov 2023 10:57:25 +0000 Subject: [PATCH] refactor: alter periodic caching --- .../io/embrace/android/embracesdk/session/SessionHandler.kt | 4 ++-- .../embrace/android/embracesdk/session/SessionHandlerTest.kt | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/embrace-android-sdk/src/main/java/io/embrace/android/embracesdk/session/SessionHandler.kt b/embrace-android-sdk/src/main/java/io/embrace/android/embracesdk/session/SessionHandler.kt index eba5296b5e..34344006f8 100644 --- a/embrace-android-sdk/src/main/java/io/embrace/android/embracesdk/session/SessionHandler.kt +++ b/embrace-android-sdk/src/main/java/io/embrace/android/embracesdk/session/SessionHandler.kt @@ -544,7 +544,7 @@ internal class SessionHandler( } try { - this.automaticSessionStopper.scheduleAtFixedRate( + this.automaticSessionStopper.scheduleWithFixedDelay( automaticSessionStopperCallback, maxSessionSeconds.toLong(), maxSessionSeconds.toLong(), @@ -592,7 +592,7 @@ internal class SessionHandler( */ private fun startPeriodicCaching(cacheCallback: Runnable) { try { - scheduledFuture = this.sessionPeriodicCacheExecutorService.scheduleAtFixedRate( + scheduledFuture = this.sessionPeriodicCacheExecutorService.scheduleWithFixedDelay( cacheCallback, 0, SESSION_CACHING_INTERVAL.toLong(), diff --git a/embrace-android-sdk/src/test/java/io/embrace/android/embracesdk/session/SessionHandlerTest.kt b/embrace-android-sdk/src/test/java/io/embrace/android/embracesdk/session/SessionHandlerTest.kt index 321b1df150..c52b3db147 100644 --- a/embrace-android-sdk/src/test/java/io/embrace/android/embracesdk/session/SessionHandlerTest.kt +++ b/embrace-android-sdk/src/test/java/io/embrace/android/embracesdk/session/SessionHandlerTest.kt @@ -211,7 +211,7 @@ internal class SessionHandlerTest { assertEquals(1, gatingService.sessionMessagesFiltered.size) // verify automatic session stopper has been scheduled verify { - mockAutomaticSessionStopper.scheduleAtFixedRate( + mockAutomaticSessionStopper.scheduleWithFixedDelay( mockAutomaticSessionStopperRunnable, maxSessionSeconds.toLong(), maxSessionSeconds.toLong(), @@ -220,7 +220,7 @@ internal class SessionHandlerTest { } // verify periodic caching worker has been scheduled verify { - mockSessionPeriodicCacheExecutorService.scheduleAtFixedRate( + mockSessionPeriodicCacheExecutorService.scheduleWithFixedDelay( mockPeriodicCachingRunnable, 0, SESSION_CACHING_INTERVAL.toLong(),