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

Method SessionForWorker

controlplane/session_mgr.go:954–963  ·  view source on GitHub ↗

SessionForWorker returns the session bound to the given cluster-unique worker id, or ok=false if this stack has none. One session per worker, so the first (only) pid in the worker's index is authoritative. Used by the admin live-query detail to address a query by worker id instead of the per-org pid

(workerID int)

Source from the content-addressed store, hash-verified

952// remote backend anyway). An error means the override did NOT take effect
953// (the session or its worker is gone), so the caller must not update its
954// session state.
955func (sm *SessionManager) SetWorkerTTLForPID(pid int32, ttl time.Duration) error {
956 sm.mu.RLock()
957 s, ok := sm.sessions[pid]
958 sm.mu.RUnlock()
959 if !ok {
960 return fmt.Errorf("no session for pid %d", pid)
961 }
962 pool, ok := sm.pool.(workerTTLPool)
963 if !ok {
964 return nil
965 }
966 if !pool.SetWorkerTTL(s.WorkerID, ttl) {

Callers 2

KillSessionByWorkerIDMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected