You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[ENH] Make HTTP client pooling configuration configurable (#63)
* feat: make HTTP client pooling configuration configurable
- Add HTTPMaxIdleConns, HTTPMaxIdleConnsPerHost, HTTPIdleTimeout fields to HFConfig
- Support environment variables: HF_HTTP_MAX_IDLE_CONNS, HF_HTTP_MAX_IDLE_CONNS_PER_HOST, HF_HTTP_IDLE_TIMEOUT
- Priority: config fields override env vars, both override defaults (100/10/90s)
- Add comprehensive tests for all configuration scenarios
- Maintain backward compatibility with sensible defaults
Closes#52
* refactor: improve HTTP pooling configuration implementation
- Extract default values as named constants for better maintainability
- Update tests to use constants instead of hardcoded values
- Add comprehensive documentation in HFConfig struct
- Update CLAUDE.md with new environment variables documentation
- Improve code clarity and consistency
Per code review suggestions in PR #63
* feat: add validation and improve HTTP pooling configuration
- Add validation to ensure maxIdleConns >= maxIdleConnsPerHost for logical consistency
- Enforce reasonable upper bounds (1000/100) to prevent resource exhaustion
- Extract env var parsing logic into reusable helper functions (getEnvInt, getEnvDuration)
- Add comprehensive documentation about performance trade-offs and recommendations
- Add test coverage for validation logic and edge cases
Per code review suggestions in PR #63
* feat: add logging and improve thread-safety documentation
- Add debug logging (DEBUG=1) to show actual HTTP pooling configuration values
- Log warnings for invalid environment variable formats to help debugging
- Document thread-safety: HTTP client initialized once per process via sync.Once
- Add clear documentation that config changes after first use won't take effect
- Improve user experience with better visibility into configuration
Per final code review suggestions in PR #63
* refactor: improve configuration robustness and visibility
- Extract magic numbers to named constants (maxAllowedIdleConns=1000, maxAllowedIdleConnsPerHost=100)
- Always log configuration warnings (not just in DEBUG mode) to help users debug issues
- Log all validation adjustments for better visibility into automatic corrections
- Add comprehensive unit tests for getEnvInt and getEnvDuration helper functions
- Improve error messages with detailed context about what went wrong
- Update test assertions to use named constants
Per final code review suggestions in PR #63
0 commit comments