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

Method DestroyAllSessions

controlplane/session_mgr.go:731–746  ·  view source on GitHub ↗

DestroyAllSessions destroys every active session without holding the manager lock while running per-session cleanup.

()

Source from the content-addressed store, hash-verified

729// naturally before invoking DestroyAllSessions for final teardown.
730func (sm *SessionManager) BeginDrain() {
731 sm.lifecycle.close()
732 sm.mu.Lock()
733 sm.failWaitersLocked(ErrSessionManagerDraining)
734 sm.mu.Unlock()
735}
736
737// DestroyAllSessions destroys every active session without holding the manager
738// lock while running per-session cleanup.
739func (sm *SessionManager) DestroyAllSessions() {
740 for {
741 sm.BeginDrain()
742 sm.mu.Lock()
743 pids := sm.sessionPIDsLocked()
744 sm.mu.Unlock()
745 if len(pids) == 0 {
746 sm.lifecycle.closeAndWait()
747 return
748 }
749 for _, pid := range pids {

Calls 5

failWaitersLockedMethod · 0.95
sessionPIDsLockedMethod · 0.95
DestroySessionMethod · 0.95
closeMethod · 0.80
closeAndWaitMethod · 0.80