mirror of https://github.com/ledisdb/ledisdb.git
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()
|
||||||
|
|
||||||
|
for i := 0; i < 100; i++ {
|
||||||
b, err := l.r.CommitIDBehind()
|
b, err := l.r.CommitIDBehind()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
} else if b {
|
} else if b {
|
||||||
AsyncNotify(l.rc)
|
l.noticeReplication()
|
||||||
l.rwg.Wait()
|
l.rwg.Wait()
|
||||||
}
|
} else {
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return errors.New("wait replication too many times")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l *Ledis) StoreLogsFromReader(rb io.Reader) error {
|
func (l *Ledis) StoreLogsFromReader(rb io.Reader) error {
|
||||||
|
|
Loading…
Reference in New Issue