Skip to content

Commit

Permalink
fix test compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
ohill committed Jun 11, 2024
1 parent 575c808 commit 7189771
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
3 changes: 2 additions & 1 deletion daemon/algod/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import (
"github.com/algorand/go-algorand/data/bookkeeping"
"github.com/algorand/go-algorand/logging"
"github.com/algorand/go-algorand/logging/telemetryspec"
"github.com/algorand/go-algorand/network"
"github.com/algorand/go-algorand/network/limitlistener"
"github.com/algorand/go-algorand/node"
"github.com/algorand/go-algorand/util"
Expand Down Expand Up @@ -146,7 +147,7 @@ func (s *Server) Initialize(cfg config.Local, phonebookAddresses []string, genes

if cfg.IsGossipServer() {
var ot basics.OverflowTracker
fdRequired = ot.Add(fdRequired, uint64(cfg.IncomingConnectionsLimit))
fdRequired = ot.Add(fdRequired, uint64(cfg.IncomingConnectionsLimit)+network.ReservedHealthServiceConnections)
if ot.Overflowed {
return errors.New("Initialize() overflowed when adding up IncomingConnectionsLimit to the existing RLIMIT_NOFILE value; decrease RestConnectionsHardLimit or IncomingConnectionsLimit")
}
Expand Down
4 changes: 2 additions & 2 deletions network/wsNetwork.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ const wsMaxHeaderBytes = 4096
// Reserved ports for the health check endpoint. This reserves capacity to query the health check service when a node is

Check failure on line 110 in network/wsNetwork.go

View workflow job for this annotation

GitHub Actions / reviewdog-errors

[Lint Errors] reported by reviewdog 🐶 exported: comment on exported const ReservedHealthServiceConnections should be of the form "ReservedHealthServiceConnections ..." (revive) Raw Output: network/wsNetwork.go:110:1: exported: comment on exported const ReservedHealthServiceConnections should be of the form "ReservedHealthServiceConnections ..." (revive) // Reserved ports for the health check endpoint. This reserves capacity to query the health check service when a node is ^
// serving maximum peers. The file descriptors will be used from the ReservedFDs pool, as this pool is meant for
// short-lived usage (dns queries, disk i/o, etc.)
const reservedHealthserviceConnections = 10
const ReservedHealthServiceConnections = 10

var networkIncomingConnections = metrics.MakeGauge(metrics.NetworkIncomingConnections)
var networkOutgoingConnections = metrics.MakeGauge(metrics.NetworkOutgoingConnections)
Expand Down Expand Up @@ -692,7 +692,7 @@ func (wn *WebsocketNetwork) Start() {
}
// wrap the original listener with a limited connection listener
listener = limitlistener.RejectingLimitListener(
listener, uint64(wn.config.IncomingConnectionsLimit)+reservedHealthserviceConnections, wn.log)
listener, uint64(wn.config.IncomingConnectionsLimit)+ReservedHealthServiceConnections, wn.log)
// wrap the limited connection listener with a requests tracker listener
wn.listener = wn.requestsTracker.Listener(listener)
wn.log.Debugf("listening on %s", wn.listener.Addr().String())
Expand Down
9 changes: 5 additions & 4 deletions rpcs/healthService_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@
package rpcs

import (
"github.com/algorand/go-algorand/network"
"github.com/algorand/go-algorand/test/partitiontest"
"github.com/stretchr/testify/require"
"io"
"net/http"
"path"
"testing"

"github.com/algorand/go-algorand/network"
"github.com/algorand/go-algorand/test/partitiontest"
"github.com/stretchr/testify/require"
)

func TestHealthService_ServeHTTP(t *testing.T) {
Expand All @@ -40,7 +41,7 @@ func TestHealthService_ServeHTTP(t *testing.T) {

client := http.Client{}

parsedURL.Path = path.Join(parsedURL.Path, HealthServiceStatusPath)
parsedURL.Path = path.Join(parsedURL.Path, network.HealthServiceStatusPath)

response, err := client.Get(parsedURL.String())
require.NoError(t, err)
Expand Down

0 comments on commit 7189771

Please sign in to comment.