OrgReservedPool presents one org's reserved slice of a shared K8s pool. It preserves the existing WorkerPool contract for SessionManager while ensuring workers are reserved to a single org for their lifetime and retired after use.
| 15 | // It preserves the existing WorkerPool contract for SessionManager while ensuring |
| 16 | // workers are reserved to a single org for their lifetime and retired after use. |
| 17 | type OrgReservedPool struct { |
| 18 | shared *K8sWorkerPool |
| 19 | orgID string |
| 20 | maxWorkers int |
| 21 | image string |
| 22 | stsBroker *STSBroker |
| 23 | activateReservedWorker func(context.Context, *ManagedWorker) error |
| 24 | // gate serializes the slow path's short DECISION section (re-check idle |
| 25 | // reuse → hot-idle claim → spawning-slot creation; see acquireDecision) in |
| 26 | // FIFO arrival order, so the next worker to become available goes to the |
| 27 | // earliest waiting connection and a later one cannot snatch it. The |
| 28 | // multi-minute spawn+activate runs OUTSIDE the gate, 1:1 bound to the |
| 29 | // waiter that owns the claim, so a cold burst ramps spawns in parallel. |
| 30 | gate *orgAcquireGate |
| 31 | } |
| 32 | |
| 33 | func NewOrgReservedPool(shared *K8sWorkerPool, orgID string, maxWorkers int, image string, stsBroker *STSBroker) *OrgReservedPool { |
| 34 | pool := &OrgReservedPool{ |
nothing calls this directly
no outgoing calls
no test coverage detected