Skip to content

Commit

Permalink
chore: add logging for reindex
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffreiffers committed Oct 15, 2024
1 parent c3fe26f commit e0c7627
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,18 @@ class ElasticUpdater(
fun reindexElastic() = runBlocking {
launch {
try {
logger.info("deleting all current concepts")

Check warning on line 24 in src/main/kotlin/no/fdk/concept_catalog/elastic/ElasticUpdater.kt

View check run for this annotation

Codecov / codecov/patch

src/main/kotlin/no/fdk/concept_catalog/elastic/ElasticUpdater.kt#L24

Added line #L24 was not covered by tests
currentConceptRepository.deleteAll()
} catch (_: Exception) { }

conceptRepository.findAll<BegrepDBO>()
.forEach {
if (it.shouldBeCurrent(currentConceptRepository.findByIdOrNull(it.originaltBegrep))) currentConceptRepository.save(CurrentConcept(it))
if (it.shouldBeCurrent(currentConceptRepository.findByIdOrNull(it.originaltBegrep))) {
logger.info("reindexing ${it.id}")
currentConceptRepository.save(CurrentConcept(it))

Check warning on line 32 in src/main/kotlin/no/fdk/concept_catalog/elastic/ElasticUpdater.kt

View check run for this annotation

Codecov / codecov/patch

src/main/kotlin/no/fdk/concept_catalog/elastic/ElasticUpdater.kt#L31-L32

Added lines #L31 - L32 were not covered by tests
} else {
logger.info("skipping not current ${it.id}")

Check warning on line 34 in src/main/kotlin/no/fdk/concept_catalog/elastic/ElasticUpdater.kt

View check run for this annotation

Codecov / codecov/patch

src/main/kotlin/no/fdk/concept_catalog/elastic/ElasticUpdater.kt#L34

Added line #L34 was not covered by tests
}
}

logger.info("finished reindexing elastic")
Expand Down

0 comments on commit e0c7627

Please sign in to comment.