Skip to content

Commit

Permalink
Delete also the former index when restarting event metrics (#5111)
Browse files Browse the repository at this point in the history
Co-authored-by: Simon Dumas <simon.dumas@epfl.ch>
  • Loading branch information
imsdu and Simon Dumas authored Aug 20, 2024
1 parent 710e1bc commit 70aeb2c
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,12 @@ object EventMetricsProjection {

for {
shouldRestart <- Env[IO].get("RESET_EVENT_METRICS").map(_.getOrElse("false").toBoolean)
_ <- IO.whenA(shouldRestart)(
logger.warn("Resetting event metrics as the env RESET_EVENT_METRICS is set") >> projections.reset(
projectionMetadata.name
)
)
_ <- IO.whenA(shouldRestart) {
client.deleteIndex(index) >>
logger.warn("Resetting event metrics as the env RESET_EVENT_METRICS is set") >> projections.reset(
projectionMetadata.name
)
}
metricsProjection <- apply(sink, supervisor, metrics, createIndex)
} yield (metricsProjection)

Expand Down

0 comments on commit 70aeb2c

Please sign in to comment.