MCPcopy
hub / github.com/redis/go-redis / newHandoffWorkerManager

Function newHandoffWorkerManager

maintnotifications/handoff_worker.go:47–58  ·  view source on GitHub ↗

newHandoffWorkerManager creates a new handoff worker manager

(config *Config, poolHook *PoolHook)

Source from the content-addressed store, hash-verified

45
46// newHandoffWorkerManager creates a new handoff worker manager
47func newHandoffWorkerManager(config *Config, poolHook *PoolHook) *handoffWorkerManager {
48 return &handoffWorkerManager{
49 handoffQueue: make(chan HandoffRequest, config.HandoffQueueSize),
50 shutdown: make(chan struct{}),
51 maxWorkers: config.MaxWorkers,
52 activeWorkers: atomic.Int32{}, // Start with no workers - create on demand
53 workerTimeout: 15 * time.Second, // Workers exit after 15s of inactivity
54 config: config,
55 poolHook: poolHook,
56 circuitBreakerManager: newCircuitBreakerManager(config),
57 }
58}
59
60// getCurrentWorkers returns the current number of active workers (for testing)
61func (hwm *handoffWorkerManager) getCurrentWorkers() int {

Callers 1

NewPoolHookWithPoolSizeFunction · 0.85

Calls 1

newCircuitBreakerManagerFunction · 0.85

Tested by

no test coverage detected