diff --git a/wsbroadcastserver/wsbroadcastserver.go b/wsbroadcastserver/wsbroadcastserver.go index fed5489636..c26a910144 100644 --- a/wsbroadcastserver/wsbroadcastserver.go +++ b/wsbroadcastserver/wsbroadcastserver.go @@ -204,11 +204,18 @@ func (s *WSBroadcastServer) Start(ctx context.Context) error { HTTPHeaderChainId: []string{strconv.FormatUint(s.chainId, 10)}, }) - return s.StartWithHeader(ctx, header) + startTime := time.Now() + err := s.StartWithHeader(ctx, header) + elapsed := time.Since(startTime) + startWithHeaderTimer.Update(elapsed) + + if err != nil { + return err + } + return nil } func (s *WSBroadcastServer) StartWithHeader(ctx context.Context, header ws.HandshakeHeader) error { - startTimeMain := time.Now() s.startMutex.Lock() defer s.startMutex.Unlock() if s.started { @@ -490,9 +497,6 @@ func (s *WSBroadcastServer) StartWithHeader(ctx context.Context, header ws.Hands s.started = true - elapsedMain := time.Since(startTimeMain) - startWithHeaderTimer.Update(elapsedMain) - return nil }