Skip to content
Snippets Groups Projects
Commit 64ef9564 authored by Jake Taylor's avatar Jake Taylor
Browse files

fix pipeline

parent 2aa7fdd9
No related branches found
No related tags found
2 merge requests!53Release,!33Hotfix/ping
...@@ -77,7 +77,7 @@ type PoolParams struct { ...@@ -77,7 +77,7 @@ type PoolParams struct {
MaxPoolSize uint32 // Maximum number of Hosts in the HostPool MaxPoolSize uint32 // Maximum number of Hosts in the HostPool
PoolSize uint32 // Allows override of HostPool size. Set to zero for dynamic size calculation PoolSize uint32 // Allows override of HostPool size. Set to zero for dynamic size calculation
ProxyAttempts uint32 // How many proxies will be used in event of send failure ProxyAttempts uint32 // How many proxies will be used in event of send failure
MaxPings uint32 // How many gateways to concurrently test when initializing HostPool MaxPings uint32 // How many gateways to concurrently test when initializing HostPool. Disabled if zero.
HostParams connect.HostParams // Parameters for the creation of new Host objects HostParams connect.HostParams // Parameters for the creation of new Host objects
} }
...@@ -87,7 +87,7 @@ func DefaultPoolParams() PoolParams { ...@@ -87,7 +87,7 @@ func DefaultPoolParams() PoolParams {
MaxPoolSize: 30, MaxPoolSize: 30,
ProxyAttempts: 5, ProxyAttempts: 5,
PoolSize: 0, PoolSize: 0,
MaxPings: 50, MaxPings: 0,
HostParams: connect.GetDefaultHostParams(), HostParams: connect.GetDefaultHostParams(),
} }
p.HostParams.MaxRetries = 1 p.HostParams.MaxRetries = 1
...@@ -157,10 +157,21 @@ func newHostPool(poolParams PoolParams, rng *fastRNG.StreamGenerator, ...@@ -157,10 +157,21 @@ func newHostPool(poolParams PoolParams, rng *fastRNG.StreamGenerator,
} }
// Build the initial HostPool and return // Build the initial HostPool and return
if result.poolParams.MaxPings > 0 {
// If pinging enabled, select random performant Hosts
err = result.initialize(uint32(numHostsAdded)) err = result.initialize(uint32(numHostsAdded))
if err != nil { if err != nil {
return nil, err return nil, err
} }
} else {
// Else, select random Hosts
for i := numHostsAdded; i < len(result.hostList); i++ {
err := result.replaceHost(result.selectGateway(), uint32(i))
if err != nil {
return nil, err
}
}
}
jww.INFO.Printf("Initialized HostPool with size: %d/%d", poolParams.PoolSize, len(netDef.Gateways)) jww.INFO.Printf("Initialized HostPool with size: %d/%d", poolParams.PoolSize, len(netDef.Gateways))
return result, nil return result, nil
......
...@@ -371,7 +371,7 @@ func TestHostPool_ForceReplace(t *testing.T) { ...@@ -371,7 +371,7 @@ func TestHostPool_ForceReplace(t *testing.T) {
oldHost := testPool.hostList[oldGatewayIndex] oldHost := testPool.hostList[oldGatewayIndex]
// Force replace the gateway at a given index // Force replace the gateway at a given index
err = testPool.forceReplace(uint32(oldGatewayIndex)) err = testPool.replaceHost(testPool.selectGateway(), uint32(oldGatewayIndex))
if err != nil { if err != nil {
t.Errorf("Failed to force replace: %v", err) t.Errorf("Failed to force replace: %v", err)
} }
......
...@@ -114,6 +114,8 @@ func NewManager(session *storage.Session, switchboard *switchboard.Switchboard, ...@@ -114,6 +114,8 @@ func NewManager(session *storage.Session, switchboard *switchboard.Switchboard,
poolParams := gateway.DefaultPoolParams() poolParams := gateway.DefaultPoolParams()
// Client will not send KeepAlive packets // Client will not send KeepAlive packets
poolParams.HostParams.KaClientOpts.Time = time.Duration(math.MaxInt64) poolParams.HostParams.KaClientOpts.Time = time.Duration(math.MaxInt64)
// Enable optimized HostPool initialization
poolParams.MaxPings = 50
m.sender, err = gateway.NewSender(poolParams, rng, m.sender, err = gateway.NewSender(poolParams, rng,
ndf, comms, session, m.NodeRegistration) ndf, comms, session, m.NodeRegistration)
if err != nil { if err != nil {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment