diff --git a/drainer/syncer.go b/drainer/syncer.go index b89c011ac..4c258d2b5 100644 --- a/drainer/syncer.go +++ b/drainer/syncer.go @@ -258,6 +258,8 @@ func (s *Syncer) savePoint(ts, slaveTS int64) { } func (s *Syncer) run() error { + defer close(s.closed) + wait := make(chan struct{}) fakeBinlogCh := make(chan *pb.Binlog, 1024) @@ -422,8 +424,6 @@ ForLoop: panic("Waiting too long for `Syncer.run` to quit.") } - close(s.closed) - // return the origin error if has, or the close error if err != nil { return err