fix: align timeout budget with wsman client for slow devices - #1153
fix: align timeout budget with wsman client for slow devices#1153amarnath-ac wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1153 +/- ##
==========================================
+ Coverage 44.45% 44.48% +0.02%
==========================================
Files 144 144
Lines 13732 13732
==========================================
+ Hits 6105 6109 +4
+ Misses 7054 7047 -7
- Partials 573 576 +3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
30dcd5a to
acbd654
Compare
There was a problem hiding this comment.
Pull request overview
This PR adjusts timeout and caching budgets so slow WSMAN operations are more likely to fail via the WSMAN client timeout (clean 504) rather than being cut off by the HTTP server or by duplicate concurrent authentication attempts.
Changes:
- Increase default HTTP server timeouts to allow longer-running handlers.
- Increase WSMAN connection-cache expiry to keep authenticated targets cached longer.
- Increase the “wait for auth” window to reduce concurrent handlers forking multiple WSMAN clients for the same device.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| pkg/httpserver/server.go | Updates default HTTP server timeouts to a larger budget. |
| internal/usecase/devices/wsman/message.go | Extends WSMAN connection cache TTL and auth-wait window to reduce duplicate client creation and keep targets warm longer. |
acbd654 to
3717685
Compare
1. httpserver read/write timeout 15s to 40s so the wsman client (30s) times out first with a clean 504. 2. waitForAuth 3s to 30s so concurrent handlers share one Target instead of forking, preserving the library concurrency cap. 3. expireAfter 30s to 60s to keep the authenticated Target cached across rapid page refreshes.
| queueTickTime = 500 * time.Millisecond | ||
| expireAfter = 30 * time.Second // expire the stored connection after 30 seconds | ||
| waitForAuth = 3 * time.Second // wait for 3 seconds for the connection to authenticate, prevents multiple api calls trying to auth at the same time | ||
| expireAfter = 90 * time.Second // expire the stored connection after 90 seconds |
There was a problem hiding this comment.
Could we make these configurable rather than hardcoded?
There was a problem hiding this comment.
Will do it in a separate PR ? because these hardcoded values are spread across multiple places and need proper config wiring.
Uh oh!
There was an error while loading. Please reload this page.