mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-09-09 14:41:02 +00:00
fix race on replicationClosing channel
monitorReplication is now not allowed to return until the goroutine it starts cancels the context. Previously, it could return just before the context was canceled which caused a race between its internal goroutine and handlePrimaryStoreEvent which recreates a channel which that internal goroutine was listening on. handlePrimaryStoreEvent already correctly made sure that monitorReplication had returned before recreating the channel, so proper handling of the sub-goroutine of monitorReplication was all that was needed to avoid this race.
This commit is contained in:
parent
e426c4215e
commit
847132d02a
1 changed files with 1 additions and 3 deletions
|
|
@ -337,9 +337,7 @@ func (s *TranslateFile) monitorReplication() {
|
|||
}
|
||||
|
||||
select {
|
||||
case <-s.closing:
|
||||
return
|
||||
case <-s.replicationClosing:
|
||||
case <-ctx.Done():
|
||||
return
|
||||
case <-time.After(s.replicationRetryInterval):
|
||||
log.Printf("pilosa: reconnecting to primary replica")
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue