refactor(process): use map for subscribers and drop dead ring buffer
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -25,7 +25,7 @@ type Session struct {
|
||||
Root string
|
||||
Cmd *exec.Cmd
|
||||
Stdin io.WriteCloser
|
||||
Subscribers []Subscription
|
||||
Subscribers map[Subscription]struct{}
|
||||
Exit ExitInfo
|
||||
mu sync.Mutex
|
||||
}
|
||||
@@ -35,10 +35,5 @@ type Session struct {
|
||||
func (s *Session) removeSubscription(sub *subscription) {
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
for i, cur := range s.Subscribers {
|
||||
if cur == sub {
|
||||
s.Subscribers = append(s.Subscribers[:i], s.Subscribers[i+1:]...)
|
||||
return
|
||||
}
|
||||
}
|
||||
delete(s.Subscribers, sub)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user