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)
| 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. |
| 955 | func (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) { |
no outgoing calls
no test coverage detected