MCPcopy Create free account
hub / github.com/dan-v/lambda-nat-proxy / WaitForSession

Method WaitForSession

internal/manager/manager.go:382–396  ·  view source on GitHub ↗

WaitForSession waits until a session is available or context is cancelled

(ctx context.Context)

Source from the content-addressed store, hash-verified

380
381// WaitForSession waits until a session is available or context is cancelled
382func (cm *ConnManager) WaitForSession(ctx context.Context) (*Session, error) {
383 ticker := time.NewTicker(100 * time.Millisecond)
384 defer ticker.Stop()
385
386 for {
387 select {
388 case <-ctx.Done():
389 return nil, ctx.Err()
390 case <-ticker.C:
391 if session := cm.GetCurrent(); session != nil {
392 return session, nil
393 }
394 }
395 }
396}
397
398// IsHealthy returns whether the session is healthy
399func (s *Session) IsHealthy() bool {

Callers 1

runProxyFunction · 0.80

Calls 1

GetCurrentMethod · 0.95

Tested by

no test coverage detected