Skip to content

Commit

Permalink
Merge pull request #741 from onflow/janez/update-dependencies
Browse files Browse the repository at this point in the history
Update cadence/flow-go/flow-go-sdk/flow-emulator dependencies
  • Loading branch information
janezpodhostnik authored Jan 31, 2025
2 parents f391084 + 09043b4 commit 54b261f
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions bootstrap/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"github.com/onflow/flow-go/fvm/evm"
flowGo "github.com/onflow/flow-go/model/flow"
"github.com/onflow/flow-go/module/component"
"github.com/onflow/flow-go/module/irrecoverable"
flowMetrics "github.com/onflow/flow-go/module/metrics"
gethTypes "github.com/onflow/go-ethereum/core/types"
"github.com/rs/zerolog"
Expand Down Expand Up @@ -368,13 +369,35 @@ func (b *Bootstrap) StartMetricsServer(ctx context.Context) error {

b.metrics = flowMetrics.NewServer(b.logger, uint(b.config.MetricsPort))

// this logic is needed since the metric server is a component.
// we need to start and stop it manually here.

ictx, errCh := irrecoverable.WithSignaler(ctx)
b.metrics.Start(ictx)
<-b.metrics.Ready()
select {
case err := <-errCh:
// there might be an error already if the startup failed
return err
default:
}

go func() {
err := <-errCh
if err != nil {
b.logger.Err(err).Msg("error in metrics server")
panic(err)
}
}()

return nil
}

func (b *Bootstrap) StopMetricsServer() {
if b.metrics == nil {
return
}
<-b.metrics.Done()
b.logger.Warn().Msg("shutting down metrics server")
}

Expand Down

0 comments on commit 54b261f

Please sign in to comment.