summaryrefslogtreecommitdiffhomepage
path: root/internal/session
diff options
context:
space:
mode:
Diffstat (limited to 'internal/session')
-rw-r--r--internal/session/manager.go15
1 files changed, 6 insertions, 9 deletions
diff --git a/internal/session/manager.go b/internal/session/manager.go
index 8df421bd8..cd80fa584 100644
--- a/internal/session/manager.go
+++ b/internal/session/manager.go
@@ -4,8 +4,8 @@ import (
"context"
"sync"
- "github.com/opencode-ai/opencode/internal/logging"
"github.com/opencode-ai/opencode/internal/pubsub"
+ "log/slog"
)
// Manager handles session management, tracking the currently active session.
@@ -41,7 +41,7 @@ func InitManager(service Service) {
// SetCurrentSession changes the active session to the one with the specified ID.
func SetCurrentSession(sessionID string) {
if globalManager == nil {
- logging.Warn("Session manager not initialized")
+ slog.Warn("Session manager not initialized")
return
}
@@ -49,18 +49,17 @@ func SetCurrentSession(sessionID string) {
defer globalManager.mu.Unlock()
globalManager.currentSessionID = sessionID
- logging.Debug("Current session changed", "sessionID", sessionID)
+ slog.Debug("Current session changed", "sessionID", sessionID)
}
// CurrentSessionID returns the ID of the currently active session.
func CurrentSessionID() string {
if globalManager == nil {
- logging.Warn("Session manager not initialized")
return ""
}
- globalManager.mu.RLock()
- defer globalManager.mu.RUnlock()
+ // globalManager.mu.RLock()
+ // defer globalManager.mu.RUnlock()
return globalManager.currentSessionID
}
@@ -69,7 +68,6 @@ func CurrentSessionID() string {
// If no session is set or the session cannot be found, it returns nil.
func CurrentSession() *Session {
if globalManager == nil {
- logging.Warn("Session manager not initialized")
return nil
}
@@ -80,9 +78,8 @@ func CurrentSession() *Session {
session, err := globalManager.service.Get(context.Background(), sessionID)
if err != nil {
- logging.Warn("Failed to get current session", "err", err)
return nil
}
return &session
-} \ No newline at end of file
+}