From 595ead55bdf4917cae78f2a869e5f98333f9a855 Mon Sep 17 00:00:00 2001 From: siddontang Date: Thu, 25 Sep 2014 10:21:50 +0800 Subject: [PATCH] bug fix: stop replication before close --- ledis/replication.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ledis/replication.go b/ledis/replication.go index e3002a7..bf7fac8 100644 --- a/ledis/replication.go +++ b/ledis/replication.go @@ -50,6 +50,9 @@ func (l *Ledis) handleReplication() { } func (l *Ledis) onReplication() { + l.wg.Add(1) + defer l.wg.Done() + AsyncNotify(l.rc) for { @@ -58,6 +61,8 @@ func (l *Ledis) onReplication() { l.handleReplication() case <-time.After(5 * time.Second): l.handleReplication() + case <-l.quit: + return } } }