Skip to content

Commit

Permalink
Reset lock documents on startup (#211)
Browse files Browse the repository at this point in the history
In the situation the services crashes or gets killed while a lock is
being held, it would startup into an incorrect state. On startup, the
lock documents are resetted to recover from such a case.

This can be problematic when many services are deployed, because it
would reset all documents right now. This will be addressed in a
future change and for the currently foreseeable future, there will be
only one instance.
  • Loading branch information
eikek authored Sep 26, 2024
1 parent aa73086 commit c48ef69
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,12 @@ object Microservice extends IOApp:
logger
.warn(s"There were ${migrateResult.migrationsSkipped} skipped migrations!")
)
// this is only safe for a single provisioning service
_ <- services.resetLockDocuments
// this is really only safe for a single provisioning service,
// but for the immediate future that is the situation. So do
// this to recover from crashes during a lock is held
_ <- services.resetLockDocuments.handleErrorWith { ex =>
logger.warn(s"Resetting locks on start failed", ex)
}
registryBuilder = CollectorRegistryBuilder[IO].withJVMMetrics
.add(RedisMetrics.queueSizeGauge)
.add(RedisMetrics.unprocessedGauge)
Expand Down

0 comments on commit c48ef69

Please sign in to comment.