Skip to content

Commit a50260e

Browse files
fuziontechclaude
andcommitted
fix: apply rate limit defaults per-field to preserve partial config
The all-or-nothing defaulting logic was silently overwriting the test harness's MaxConnections: 100 because MaxFailedAttempts was zero, causing CI to reject connections on low-CPU runners. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 2ecfc75 commit a50260e

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

server/server.go

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,9 +234,22 @@ type Server struct {
234234
}
235235

236236
func New(cfg Config) (*Server, error) {
237-
// Use default rate limit config if not specified
237+
// Apply default rate limit config for any unset fields
238+
defaults := DefaultRateLimitConfig()
238239
if cfg.RateLimit.MaxFailedAttempts == 0 {
239-
cfg.RateLimit = DefaultRateLimitConfig()
240+
cfg.RateLimit.MaxFailedAttempts = defaults.MaxFailedAttempts
241+
}
242+
if cfg.RateLimit.FailedAttemptWindow == 0 {
243+
cfg.RateLimit.FailedAttemptWindow = defaults.FailedAttemptWindow
244+
}
245+
if cfg.RateLimit.BanDuration == 0 {
246+
cfg.RateLimit.BanDuration = defaults.BanDuration
247+
}
248+
if cfg.RateLimit.MaxConnectionsPerIP == 0 {
249+
cfg.RateLimit.MaxConnectionsPerIP = defaults.MaxConnectionsPerIP
250+
}
251+
if cfg.RateLimit.MaxConnections == 0 {
252+
cfg.RateLimit.MaxConnections = defaults.MaxConnections
240253
}
241254

242255
// Use default shutdown timeout if not specified

0 commit comments

Comments
 (0)