Skip to content

Commit

Permalink
improve error handling while serving http request for ping server
Browse files Browse the repository at this point in the history
  • Loading branch information
eddyzags committed Jan 27, 2025
1 parent 1f9325f commit 446fcd1
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pkg/relayer/relayminer.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package relayer

import (
"context"
"errors"
"net"
"net/http"
"net/http/pprof"
Expand Down Expand Up @@ -148,8 +149,8 @@ func (rel *relayMiner) ServePing(ctx context.Context, network, addr string) erro
// ping requests. A single ping request on the relay server broadcasts a
// ping to all backing services/data nodes.
go func() {
if err := http.Serve(ln, rel.newPinghandlerFn(ctx, ln)); err != nil {
rel.logger.Error().Err(err).Msg("unable to serve ping server")
if err := http.Serve(ln, rel.newPinghandlerFn(ctx, ln)); err != nil && !errors.Is(http.ErrServerClosed, err) {
rel.logger.Error().Err(err).Msg("ping server unexpectedly closed")
}
}()

Expand Down

0 comments on commit 446fcd1

Please sign in to comment.