Skip to content

Commit 9ac856a

Browse files
authored
config: disallow ThrottlerConfig.MaxRecheckDelay < 1 ms (ava-labs#1435)
1 parent 3d2537b commit 9ac856a

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

config/config.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,10 @@ func getNetworkConfig(
433433
return network.Config{}, fmt.Errorf("%q must be >= 0", OutboundConnectionTimeoutKey)
434434
case config.PeerListGossipFreq < 0:
435435
return network.Config{}, fmt.Errorf("%s must be >= 0", NetworkPeerListGossipFreqKey)
436+
case config.ThrottlerConfig.InboundMsgThrottlerConfig.CPUThrottlerConfig.MaxRecheckDelay < constants.MinInboundThrottlerMaxRecheckDelay:
437+
return network.Config{}, fmt.Errorf("%s must be >= %d", InboundThrottlerCPUMaxRecheckDelayKey, constants.MinInboundThrottlerMaxRecheckDelay)
438+
case config.ThrottlerConfig.InboundMsgThrottlerConfig.DiskThrottlerConfig.MaxRecheckDelay < constants.MinInboundThrottlerMaxRecheckDelay:
439+
return network.Config{}, fmt.Errorf("%s must be >= %d", InboundThrottlerDiskMaxRecheckDelayKey, constants.MinInboundThrottlerMaxRecheckDelay)
436440
case config.MaxReconnectDelay < 0:
437441
return network.Config{}, fmt.Errorf("%s must be >= 0", NetworkMaxReconnectDelayKey)
438442
case config.InitialReconnectDelay < 0:

utils/constants/networking.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ const (
100100
DefaultInboundThrottlerBandwidthMaxBurstSize = DefaultMaxMessageSize
101101
DefaultInboundThrottlerCPUMaxRecheckDelay = 5 * time.Second
102102
DefaultInboundThrottlerDiskMaxRecheckDelay = 5 * time.Second
103+
MinInboundThrottlerMaxRecheckDelay = time.Millisecond
103104

104105
// Outbound Throttling
105106
DefaultOutboundThrottlerAtLargeAllocSize = 32 * units.MiB

0 commit comments

Comments
 (0)