1
0
Fork 0
mirror of https://github.com/anyproto/any-sync.git synced 2025-06-08 05:57:03 +09:00

consensus: fix race

This commit is contained in:
Sergey Cherepanov 2023-07-11 12:02:15 +02:00
parent 1a23081336
commit ebf4034ec7
No known key found for this signature in database
GPG key ID: 87F8EDE8FBDF637C

View file

@ -212,6 +212,7 @@ func (s *service) streamReader() error {
if len(events) == 0 {
return s.stream.Err()
}
s.mu.Lock()
for _, e := range events {
if w, ok := s.watchers[e.LogId]; ok {
if e.Error == nil {
@ -223,6 +224,7 @@ func (s *service) streamReader() error {
log.Warn("received unexpected log id", zap.String("logId", e.LogId))
}
}
s.mu.Unlock()
}
}