From f0c51a23b9b9b5b306bad87ab792434c2a09a6d3 Mon Sep 17 00:00:00 2001 From: Crypto Minion <154598612+jrwbabylonlab@users.noreply.github.com> Date: Thu, 12 Dec 2024 22:38:38 +1100 Subject: [PATCH] chore: initialise metric server after script in main (#178) --- cmd/staking-api-service/main.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/cmd/staking-api-service/main.go b/cmd/staking-api-service/main.go index 3b42b5b..b05f50c 100644 --- a/cmd/staking-api-service/main.go +++ b/cmd/staking-api-service/main.go @@ -60,10 +60,6 @@ func main() { log.Fatal().Err(err).Msg(fmt.Sprintf("error while loading finality providers file: %s", finalityProvidersPath)) } - // initialize metrics with the metrics port from config - metricsPort := cfg.Metrics.GetMetricsPort() - metrics.Init(metricsPort) - err = dbmodel.Setup(ctx, cfg) if err != nil { log.Fatal().Err(err).Msg("error while setting up staking db model") @@ -103,6 +99,11 @@ func main() { return } + // initialize metrics with the metrics port from config + metricsPort := cfg.Metrics.GetMetricsPort() + metrics.Init(metricsPort) + + // Start the event queue processing v2queues.StartReceivingMessages() healthcheckErr := healthcheck.StartHealthCheckCron(ctx, v2queues, cfg.Server.HealthCheckInterval)