forked from mirror/ledisdb
bugfix for wait replication
This commit is contained in:
parent
2a3fca829e
commit
5786b72eb1
|
@ -89,18 +89,20 @@ func (l *Ledis) WaitReplication() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
l.noticeReplication()
|
l.noticeReplication()
|
||||||
|
|
||||||
l.rwg.Wait()
|
l.rwg.Wait()
|
||||||
|
|
||||||
b, err := l.r.CommitIDBehind()
|
for i := 0; i < 100; i++ {
|
||||||
if err != nil {
|
b, err := l.r.CommitIDBehind()
|
||||||
return err
|
if err != nil {
|
||||||
} else if b {
|
return err
|
||||||
AsyncNotify(l.rc)
|
} else if b {
|
||||||
l.rwg.Wait()
|
l.noticeReplication()
|
||||||
|
l.rwg.Wait()
|
||||||
|
} else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return errors.New("wait replication too many times")
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l *Ledis) StoreLogsFromReader(rb io.Reader) error {
|
func (l *Ledis) StoreLogsFromReader(rb io.Reader) error {
|
||||||
|
|
Loading…
Reference in New Issue