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