-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure Cache manifest for new PlanLimit queries is periodically updated
- Loading branch information
Showing
2 changed files
with
34 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
packages/Manager/src/main/kotlin/nz/govt/eop/tasks/PlanLimitsManifestUpdater.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package nz.govt.eop.tasks | ||
|
||
import java.util.concurrent.TimeUnit | ||
import mu.KotlinLogging | ||
import net.javacrumbs.shedlock.spring.annotation.SchedulerLock | ||
import nz.govt.eop.plan_limits.Manifest | ||
import org.jooq.DSLContext | ||
import org.springframework.scheduling.annotation.Scheduled | ||
import org.springframework.stereotype.Component | ||
|
||
@Component | ||
class PlanLimitsManifestUpdater(val context: DSLContext, val manifest: Manifest) { | ||
|
||
private val logger = KotlinLogging.logger {} | ||
@Scheduled(fixedDelay = 1, timeUnit = TimeUnit.MINUTES) | ||
@SchedulerLock(name = "planLimitsManifestUpdater") | ||
fun updateManifest() { | ||
logger.debug { startTaskMessage("planLimitsManifestUpdater") } | ||
manifest.updateAll() | ||
logger.debug { endTaskMessage("planLimitsManifestUpdater") } | ||
} | ||
} |