chore: rename once to startOnce

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
Bo-Yi Wu 2021-07-24 11:00:04 +08:00
parent 6db9768758
commit a210abd323
1 changed files with 2 additions and 2 deletions

View File

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