M1: broadcast focus updates, expiry uses Expire outcome

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-05-31 12:52:55 -04:00
parent df384afb7c
commit 63418d106f
2 changed files with 34 additions and 3 deletions
+5 -3
View File
@@ -31,7 +31,9 @@ type Server struct {
}
func NewServer(ctrl *session.Controller) *Server {
return &Server{ctrl: ctrl, bcast: NewBroadcaster()}
s := &Server{ctrl: ctrl, bcast: NewBroadcaster()}
ctrl.SetOnChange(s.broadcast)
return s
}
func (s *Server) Router() *gin.Engine {
@@ -154,7 +156,7 @@ func (s *Server) armExpiry() {
d = 0
}
s.timer = time.AfterFunc(d, func() {
if err := s.ctrl.Complete(); err == nil {
if err := s.ctrl.Expire(); err == nil {
s.broadcast()
}
})
@@ -179,7 +181,7 @@ func (s *Server) Init() {
s.armExpiry()
return
}
if err := s.ctrl.Complete(); err == nil {
if err := s.ctrl.Expire(); err == nil {
s.broadcast()
}
}