bug fix: stop replication before close

This commit is contained in:
siddontang 2014-09-25 10:21:50 +08:00
parent 6d293ce152
commit 595ead55bd
1 changed files with 5 additions and 0 deletions

View File

@ -50,6 +50,9 @@ func (l *Ledis) handleReplication() {
} }
func (l *Ledis) onReplication() { func (l *Ledis) onReplication() {
l.wg.Add(1)
defer l.wg.Done()
AsyncNotify(l.rc) AsyncNotify(l.rc)
for { for {
@ -58,6 +61,8 @@ func (l *Ledis) onReplication() {
l.handleReplication() l.handleReplication()
case <-time.After(5 * time.Second): case <-time.After(5 * time.Second):
l.handleReplication() l.handleReplication()
case <-l.quit:
return
} }
} }
} }