diff --git a/go.mod b/go.mod index 4451262..a785c21 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( cosmossdk.io/math v1.1.2 github.com/ethereum/go-ethereum v1.13.4 github.com/golangci/golangci-lint v1.55.2 - github.com/ojo-network/indexer v0.0.5 + github.com/ojo-network/indexer v0.0.6 github.com/rs/zerolog v1.31.0 github.com/spf13/viper v1.12.0 ) diff --git a/go.sum b/go.sum index 861f667..e4048d7 100644 --- a/go.sum +++ b/go.sum @@ -479,8 +479,8 @@ github.com/nunnatsa/ginkgolinter v0.14.1 h1:khx0CqR5U4ghsscjJ+lZVthp3zjIFytRXPTa github.com/nunnatsa/ginkgolinter v0.14.1/go.mod h1:nY0pafUSst7v7F637e7fymaMlQqI9c0Wka2fGsDkzWg= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= -github.com/ojo-network/indexer v0.0.5 h1:TsJcTzntRkMlGzLcltmybeN5Ux3gOMn3mr5FS431q1A= -github.com/ojo-network/indexer v0.0.5/go.mod h1:Zi3h9u2KGKyhKIZd0V5BcBMOh6cVySGdeo3Dv54Var8= +github.com/ojo-network/indexer v0.0.6 h1:Z1z/DkHw+XXc04B+8nkYs2woR2J+P+rmzHNSYD3uxSw= +github.com/ojo-network/indexer v0.0.6/go.mod h1:Zi3h9u2KGKyhKIZd0V5BcBMOh6cVySGdeo3Dv54Var8= github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= diff --git a/main.go b/main.go index 5fce6ba..907abdb 100644 --- a/main.go +++ b/main.go @@ -28,14 +28,22 @@ func main() { } // Create new websocket and REST server for each exchange - for _, exchange := range cfg.Exchanges { + for iter, exchange := range cfg.Exchanges { + // Only register base health check on one server to avoid multiple registrations panic + var registerBaseHealthCheck bool + if iter == 0 { + registerBaseHealthCheck = true + } else { + registerBaseHealthCheck = false + } + // Initialize indexer i := indexer.NewIndexer(logger, ctx) // Start and maintain connection to blockchain nodes client.MaintainConnection(exchange, i, ctx, logger) - s, err := server.NewServer(logger, cfg.Server, cfg.AssetPairs(exchange)) + s, err := server.NewServer(logger, cfg.Server, cfg.AssetPairs(exchange), registerBaseHealthCheck) if err != nil { logger.Error().Err(err).Msg("error creating server") cancel()