MCPcopy Create free account
hub / github.com/PostHog/duckgres / OrgReservedPool

Struct OrgReservedPool

controlplane/org_reserved_pool.go:17–31  ·  view source on GitHub ↗

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.

Source from the content-addressed store, hash-verified

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.
17type 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
33func NewOrgReservedPool(shared *K8sWorkerPool, orgID string, maxWorkers int, image string, stsBroker *STSBroker) *OrgReservedPool {
34 pool := &OrgReservedPool{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected