From a210abd32380aff23a9b1f1662e56dd4676b05b6 Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Sat, 24 Jul 2021 11:00:04 +0800 Subject: [PATCH] chore: rename once to startOnce Signed-off-by: Bo-Yi Wu --- queue/nsq/nsq.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/queue/nsq/nsq.go b/queue/nsq/nsq.go index 2c08b29..d5320c4 100644 --- a/queue/nsq/nsq.go +++ b/queue/nsq/nsq.go @@ -21,7 +21,7 @@ type Option func(*Worker) type Worker struct { q *nsq.Consumer p *nsq.Producer - once sync.Once + startOnce sync.Once maxInFlight int addr string topic string @@ -116,7 +116,7 @@ func (s *Worker) BeforeRun() error { // AfterRun run script after start worker func (s *Worker) AfterRun() error { - s.once.Do(func() { + s.startOnce.Do(func() { time.Sleep(100 * time.Millisecond) err := s.q.ConnectToNSQD(s.addr) if err != nil {