@@ -277,16 +277,21 @@ func (p *Proxy) processAttempt(msg websocket.IncomingMessage) {
277277
278278 activeCount := atomic .LoadInt32 (& p .activeRequests )
279279
280+ // Calculate warning thresholds proportionally to max connections
281+ maxConns := int32 (p .transport .MaxConnsPerHost )
282+ warningThreshold := int32 (float64 (maxConns ) * 0.8 ) // Warn at 80% capacity
283+ resetThreshold := int32 (float64 (maxConns ) * 0.6 ) // Reset warning at 60% capacity
284+
280285 // Warn when approaching connection limit
281- if activeCount > 40 && ! p .maxConnWarned {
286+ if activeCount > warningThreshold && ! p .maxConnWarned {
282287 p .maxConnWarned = true
283288 color := ansi .Color (os .Stdout )
284289 fmt .Printf ("\n %s High connection load detected (%d active requests)\n " ,
285290 color .Yellow ("⚠ WARNING:" ), activeCount )
286291 fmt .Printf (" The CLI is limited to %d concurrent connections per host.\n " , p .transport .MaxConnsPerHost )
287292 fmt .Printf (" Consider reducing request rate or increasing connection limit.\n " )
288- fmt .Printf (" Run with --max-connections=100 to increase the limit.\n \n " )
289- } else if activeCount < 30 && p .maxConnWarned {
293+ fmt .Printf (" Run with --max-connections=%d to increase the limit.\n \n " , maxConns * 2 )
294+ } else if activeCount < resetThreshold && p .maxConnWarned {
290295 // Reset warning flag when load decreases
291296 p .maxConnWarned = false
292297 }
@@ -424,8 +429,7 @@ func New(cfg *Config, connections []*hookdecksdk.Connection) *Proxy {
424429 transport : tr ,
425430 httpClient : & http.Client {
426431 Transport : tr ,
427- // Default timeout can be overridden per request
428- Timeout : 30 * time .Second ,
432+ // Timeout is controlled per-request via context in processAttempt
429433 },
430434 }
431435
0 commit comments