chore: rename once to startOnce
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
parent
6db9768758
commit
a210abd323
|
@ -21,7 +21,7 @@ type Option func(*Worker)
|
||||||
type Worker struct {
|
type Worker struct {
|
||||||
q *nsq.Consumer
|
q *nsq.Consumer
|
||||||
p *nsq.Producer
|
p *nsq.Producer
|
||||||
once sync.Once
|
startOnce sync.Once
|
||||||
maxInFlight int
|
maxInFlight int
|
||||||
addr string
|
addr string
|
||||||
topic string
|
topic string
|
||||||
|
@ -116,7 +116,7 @@ func (s *Worker) BeforeRun() error {
|
||||||
|
|
||||||
// AfterRun run script after start worker
|
// AfterRun run script after start worker
|
||||||
func (s *Worker) AfterRun() error {
|
func (s *Worker) AfterRun() error {
|
||||||
s.once.Do(func() {
|
s.startOnce.Do(func() {
|
||||||
time.Sleep(100 * time.Millisecond)
|
time.Sleep(100 * time.Millisecond)
|
||||||
err := s.q.ConnectToNSQD(s.addr)
|
err := s.q.ConnectToNSQD(s.addr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue