Skip to content

feat: per-server call timeout (ServerConfig.CallTimeout)#5

Merged
inhuman merged 1 commit into
mainfrom
006-per-server-timeout
May 11, 2026
Merged

feat: per-server call timeout (ServerConfig.CallTimeout)#5
inhuman merged 1 commit into
mainfrom
006-per-server-timeout

Conversation

@inhuman
Copy link
Copy Markdown
Owner

@inhuman inhuman commented May 11, 2026

Summary

  • Adds ServerConfig.CallTimeout time.Duration — per-server call timeout override
  • Zero or negative value inherits the multiplexer-wide default set via WithCallTimeout (default 30 s)
  • Single private helper effectiveTimeout(perServer, global) in caller.go resolves the effective value; timeout error messages report it accurately
  • No new dependencies; fully backward-compatible (zero-value field = existing behaviour)

Changes

File Change
config.go New CallTimeout field with godoc
caller.go effectiveTimeout helper + use in CallTool
timeout_test.go 3 integration tests (per-server fires, zero inherits global, negative as zero)
doc.go Mention per-server timeout in package overview
CHANGELOG.md Entry under Unreleased

Test plan

  • TestPerServerTimeout_ShortTimeoutFires — per-server 150ms fires, other server with global 10s succeeds
  • TestPerServerTimeout_ZeroInheritsGlobal — zero CallTimeout uses global 50ms
  • TestPerServerTimeout_NegativeTreatedAsZero — negative treated as zero
  • go test -race ./... — full suite green
  • golangci-lint run ./... — 0 issues

Zero or negative value inherits the multiplexer-wide default (WithCallTimeout).
Timeout resolution is a single helper effectiveTimeout in caller.go; error
messages report the effective value so users can distinguish per-server
vs global timeouts. Three integration tests cover the per-server, zero-inherit,
and negative-as-zero cases; race detector clean.
@inhuman inhuman merged commit 44a4cce into main May 11, 2026
3 checks passed
@inhuman inhuman deleted the 006-per-server-timeout branch May 11, 2026 13:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant