storage: use non-blocking send to StateUpdateChan

This commit is contained in:
Chris Lu
2026-01-12 10:49:26 -08:00
parent 2af293ce60
commit 587e782feb

View File

@@ -161,7 +161,11 @@ func NewStore(
func (s *Store) LoadState() error {
err := s.State.Load()
if s.State.Pb != nil && err == nil {
s.StateUpdateChan <- s.State.Pb
select {
case s.StateUpdateChan <- s.State.Pb:
default:
glog.V(2).Infof("StateUpdateChan full during LoadState, state will be reported in heartbeat")
}
}
return err
}
@@ -174,7 +178,11 @@ func (s *Store) SaveState() error {
err := s.State.Save()
if s.State.Pb != nil && err == nil {
s.StateUpdateChan <- s.State.Pb
select {
case s.StateUpdateChan <- s.State.Pb:
default:
glog.V(2).Infof("StateUpdateChan full during SaveState, state will be reported in heartbeat")
}
}
return err
}