From 94c3820fb3235b16024b439da7ce30374a736b97 Mon Sep 17 00:00:00 2001 From: Yatharth Ranjan Date: Wed, 10 May 2023 16:50:25 +0100 Subject: [PATCH 1/4] snapshot version --- build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index 1dfcaa3..b7b8d21 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -15,7 +15,7 @@ description = "RADAR Push API Gateway to handle secured data flow to backend." allprojects { group = "org.radarbase" - version = "0.3.0" + version = "0.3.1-SNAPSHOT" repositories { mavenCentral() From bcf0ee07dbfd9338da43e2a9c182ccc637ecb649 Mon Sep 17 00:00:00 2001 From: yatharthranjan Date: Tue, 16 May 2023 11:36:03 +0100 Subject: [PATCH 2/4] fix summaryId parsing in sleepScore --- .../garmin/converter/SleepScoreGarminAvroConverter.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/kotlin/org/radarbase/push/integration/garmin/converter/SleepScoreGarminAvroConverter.kt b/src/main/kotlin/org/radarbase/push/integration/garmin/converter/SleepScoreGarminAvroConverter.kt index 3fdda70..45f4bb0 100644 --- a/src/main/kotlin/org/radarbase/push/integration/garmin/converter/SleepScoreGarminAvroConverter.kt +++ b/src/main/kotlin/org/radarbase/push/integration/garmin/converter/SleepScoreGarminAvroConverter.kt @@ -18,7 +18,7 @@ class SleepScoreGarminAvroConverter( private fun getRecord(node: JsonNode): SpecificRecord { return GarminSleepScoreSample.newBuilder().apply { - summaryId = summaryId + summaryId = node["summaryId"]?.asText() time = node["startTimeInSeconds"].asDouble() startTimeOffset = node["startTimeOffsetInSeconds"]?.asInt() timeReceived = Instant.now().toEpochMilli() / 1000.0 From 53dc9aeaeb871620a608cc0a92c710f047e4c6a4 Mon Sep 17 00:00:00 2001 From: yatharthranjan Date: Tue, 16 May 2023 14:15:08 +0100 Subject: [PATCH 3/4] make garmin backfill request rate configurable --- src/main/kotlin/org/radarbase/gateway/Config.kt | 6 ++++-- .../push/integration/garmin/service/BackfillService.kt | 10 +++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/main/kotlin/org/radarbase/gateway/Config.kt b/src/main/kotlin/org/radarbase/gateway/Config.kt index 6cfaa25..cd8c996 100644 --- a/src/main/kotlin/org/radarbase/gateway/Config.kt +++ b/src/main/kotlin/org/radarbase/gateway/Config.kt @@ -80,7 +80,7 @@ data class GarminConfig( if (enabled) { check(GarminUserRepository::class.java.isAssignableFrom(userRepository)) { "$userRepositoryClass is not valid. Please specify a class that is a subclass of" + - " `org.radarbase.push.integration.garmin.user.GarminUserRepository`" + " `org.radarbase.push.integration.garmin.user.GarminUserRepository`" } } } @@ -91,7 +91,9 @@ data class BackfillConfig( val redis: RedisConfig = RedisConfig(), val maxThreads: Int = 4, val defaultEndDate: Instant = Instant.MAX, - val userBackfill: List = emptyList() + val userBackfill: List = emptyList(), + val requestsPerUserPerIteration: Int = 40, + val iterationIntervalMinutes: Long = 5, ) data class RedisConfig( diff --git a/src/main/kotlin/org/radarbase/push/integration/garmin/service/BackfillService.kt b/src/main/kotlin/org/radarbase/push/integration/garmin/service/BackfillService.kt index 083cee0..6fcd341 100644 --- a/src/main/kotlin/org/radarbase/push/integration/garmin/service/BackfillService.kt +++ b/src/main/kotlin/org/radarbase/push/integration/garmin/service/BackfillService.kt @@ -47,7 +47,7 @@ class BackfillService( ) private val requestsPerUserPerIteration: Int - get() = 40 + get() = config.pushIntegration.garmin.backfill.requestsPerUserPerIteration private val futures: MutableList> = mutableListOf() @@ -64,7 +64,12 @@ class BackfillService( private fun start() { logger.info("Application Initialisation completed. Starting Backfill service...") - executorService.scheduleAtFixedRate(::iterateUsers, 1, 5, TimeUnit.MINUTES) + executorService.scheduleAtFixedRate( + ::iterateUsers, + 1, + config.pushIntegration.garmin.backfill.iterationIntervalMinutes, + TimeUnit.MINUTES + ) } private fun stop() { @@ -124,6 +129,5 @@ class BackfillService( companion object { private val logger = LoggerFactory.getLogger(BackfillService::class.java) - private const val WAIT_TIME_MS = 10_000L } } From 872a725fa93e4ba03c5de97c129f04442c80d286 Mon Sep 17 00:00:00 2001 From: Yatharth Ranjan Date: Tue, 16 May 2023 14:31:27 +0100 Subject: [PATCH 4/4] release version --- build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index b7b8d21..abb0f44 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -15,7 +15,7 @@ description = "RADAR Push API Gateway to handle secured data flow to backend." allprojects { group = "org.radarbase" - version = "0.3.1-SNAPSHOT" + version = "0.3.1" repositories { mavenCentral()