bugfix for wait replication

This commit is contained in:
siddontang 2014-09-28 21:55:25 +08:00
parent 2a3fca829e
commit 5786b72eb1
1 changed files with 11 additions and 9 deletions

View File

@ -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() {