Skip to content

Commit

Permalink
Merge pull request #59 from RADAR-base/release-0.3.1
Browse files Browse the repository at this point in the history
Release 0.3.1
  • Loading branch information
yatharthranjan authored May 16, 2023
2 parents 660790e + 872a725 commit 7d4f3ad
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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"

repositories {
mavenCentral()
Expand Down
6 changes: 4 additions & 2 deletions src/main/kotlin/org/radarbase/gateway/Config.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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`"
}
}
}
Expand All @@ -91,7 +91,9 @@ data class BackfillConfig(
val redis: RedisConfig = RedisConfig(),
val maxThreads: Int = 4,
val defaultEndDate: Instant = Instant.MAX,
val userBackfill: List<UserBackfillConfig> = emptyList()
val userBackfill: List<UserBackfillConfig> = emptyList(),
val requestsPerUserPerIteration: Int = 40,
val iterationIntervalMinutes: Long = 5,
)

data class RedisConfig(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class BackfillService(
)

private val requestsPerUserPerIteration: Int
get() = 40
get() = config.pushIntegration.garmin.backfill.requestsPerUserPerIteration

private val futures: MutableList<Future<*>> = mutableListOf()

Expand All @@ -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() {
Expand Down Expand Up @@ -124,6 +129,5 @@ class BackfillService(

companion object {
private val logger = LoggerFactory.getLogger(BackfillService::class.java)
private const val WAIT_TIME_MS = 10_000L
}
}

0 comments on commit 7d4f3ad

Please sign in to comment.