f-37: migration: add state change at boot #37
Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
This commit is contained in:
parent
aa6611249b
commit
fef04b10fc
3 changed files with 267 additions and 0 deletions
|
|
@ -8,6 +8,7 @@ import (
|
|||
agentapi "git.g3e.fr/syonad/two/internal/api/agent"
|
||||
configuration "git.g3e.fr/syonad/two/internal/config/agent"
|
||||
dispatcher "git.g3e.fr/syonad/two/internal/dispatcher/agent"
|
||||
"git.g3e.fr/syonad/two/internal/migration"
|
||||
agentmetrics "git.g3e.fr/syonad/two/internal/prometheus/agent"
|
||||
"git.g3e.fr/syonad/two/pkg/db/kv"
|
||||
"git.g3e.fr/syonad/two/pkg/logger"
|
||||
|
|
@ -31,6 +32,13 @@ func main() {
|
|||
db := kv.InitDB(kv.Config{Path: cfg.Database.Path}, false)
|
||||
defer db.Close()
|
||||
|
||||
// Avant tout démarrage de service : la DB peut porter l'ancien vocabulaire
|
||||
// d'états, et des ressources transitoires orphelines d'un arrêt précédent.
|
||||
if err := migration.MigrateStates(db, log.With(slog.String("component", "migration"))); err != nil {
|
||||
log.Error("failed to migrate states", "error", err)
|
||||
return
|
||||
}
|
||||
|
||||
q := worker.New(cfg.Worker.BufferSize)
|
||||
q.Start(cfg.Worker.Count)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue