Skip to content

Commit

Permalink
fix: Register base healthcheck on one server
Browse files Browse the repository at this point in the history
  • Loading branch information
rbajollari committed Aug 21, 2024
1 parent f9cf4f8 commit 877312b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ 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 h1:8B0AHMVF5a8E0VMxAV6R88vpO4yO81oFKaNA+ELCvVY=
github.com/ojo-network/indexer v0.0.5/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=
Expand Down
12 changes: 10 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,22 @@ func main() {
}

// Create new websocket and REST server for each exchange
for _, exchange := range cfg.Exchanges {
for j, exchange := range cfg.Exchanges {
// Only register base health check on one server to avoid multiple registrations panic
var registerBaseHealthCheck bool
if j == 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()
Expand Down

0 comments on commit 877312b

Please sign in to comment.