Skip to content

SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.

storage: use non-blocking send to StateUpdateChan

Chris Lu587e782feb05
diff --git a/weed/storage/store.go b/weed/storage/store.go
index 5343ec12d8..3899806676 100644
--- a/weed/storage/store.go
+++ b/weed/storage/store.go
@@ -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
}