Skip to content

Commit

Permalink
IS-1671: Increase behandlende enhet cronjob freq (#324)
Browse files Browse the repository at this point in the history
  • Loading branch information
andersrognstad authored Oct 17, 2023
1 parent 8ab97e4 commit 35f13e4
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions .nais/naiserator-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -99,5 +99,5 @@ spec:
# Bruk samme dato i enhetens-oversikt-query og index
- name: ARENA_CUTOFF
value: "2023-03-10"
- name: IS_HUSKELAPP_CONSUMER_ENABLED
value: "true"
- name: CRONJOB_BEHANDLENDE_ENHET_INTERVAL_DELAY_MINUTES
value: "2"
4 changes: 2 additions & 2 deletions .nais/naiserator-prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -101,5 +101,5 @@ spec:
# Bruk samme dato i enhetens-oversikt-query og index
- name: ARENA_CUTOFF
value: "2023-03-10"
- name: IS_HUSKELAPP_CONSUMER_ENABLED
value: "true"
- name: CRONJOB_BEHANDLENDE_ENHET_INTERVAL_DELAY_MINUTES
value: "15"
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ data class Environment(
secret = getEnvVar("REDIS_PASSWORD"),
),

val isHuskelappConsumerEnabled: Boolean = getEnvVar("IS_HUSKELAPP_CONSUMER_ENABLED").toBoolean()
val cronjobBehandlendeEnhetIntervalDelayMinutes: Long = getEnvVar("CRONJOB_BEHANDLENDE_ENHET_INTERVAL_DELAY_MINUTES").toLong(),
)

fun getEnvVar(varName: String, defaultValue: String? = null) =
Expand Down
1 change: 1 addition & 0 deletions src/main/kotlin/no/nav/syfo/cronjob/CronjobModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ fun launchCronjobModule(
)
val personBehandlendeEnhetCronjob = PersonBehandlendeEnhetCronjob(
personBehandlendeEnhetService = personBehandlendeEnhetService,
intervalDelayMinutes = environment.cronjobBehandlendeEnhetIntervalDelayMinutes,
)

val reaperService = ReaperService(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import org.slf4j.LoggerFactory

class PersonBehandlendeEnhetCronjob(
private val personBehandlendeEnhetService: PersonBehandlendeEnhetService,
override val intervalDelayMinutes: Long,
) : Cronjob {

override val initialDelayMinutes: Long = 2
override val intervalDelayMinutes: Long = 60L

override suspend fun run() {
runJob()
Expand Down
10 changes: 4 additions & 6 deletions src/main/kotlin/no/nav/syfo/kafka/KafkaModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,8 @@ fun launchKafkaModule(
environment = environment,
)

if (environment.isHuskelappConsumerEnabled) {
launchHuskelappConsumer(
applicationState = applicationState,
kafkaEnvironment = environment.kafka,
)
}
launchHuskelappConsumer(
applicationState = applicationState,
kafkaEnvironment = environment.kafka,
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class InternalMockEnvironment private constructor() {
)
val personBehandlendeEnhetCronjob = PersonBehandlendeEnhetCronjob(
personBehandlendeEnhetService = personBehandlendeEnhetService,
intervalDelayMinutes = environment.cronjobBehandlendeEnhetIntervalDelayMinutes,
)

private val personOppfolgingstilfelleVirksomhetsnavnService = PersonOppfolgingstilfelleVirksomhetsnavnService(
Expand Down
2 changes: 1 addition & 1 deletion src/test/kotlin/no/nav/syfo/testutil/TestEnvironment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ fun testEnvironment(
port = 6376,
secret = "password",
),
isHuskelappConsumerEnabled = true,
cronjobBehandlendeEnhetIntervalDelayMinutes = 5,
)

fun testAppState() = ApplicationState(
Expand Down

0 comments on commit 35f13e4

Please sign in to comment.