Skip to content

Commit

Permalink
feat: hotfix update nsqd connection config (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
JTrancender authored Aug 27, 2021
1 parent 9c837e7 commit 95f5fee
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions consumer/consumer.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,12 @@ type Consumer struct {
}

type NSQConsumer struct {
done chan struct{}
topics map[string]*Consumer
wg sync.WaitGroup
opts *Options
cfg *nsq.Config
done chan struct{}
topics map[string]*Consumer
wg sync.WaitGroup
opts *Options
cfg *nsq.Config
consumerType string

queue chan *Message

Expand Down Expand Up @@ -72,11 +73,12 @@ func newNSQConsumer(c *consumer.ConsumerEntity, settings instance.Settings, rawC

queue := make(chan *Message)
consumer := &NSQConsumer{
done: make(chan struct{}),
opts: opts,
cfg: cfg,
topics: make(map[string]*Consumer),
queue: queue,
done: make(chan struct{}),
opts: opts,
cfg: cfg,
topics: make(map[string]*Consumer),
queue: queue,
consumerType: consumerType,
}
return consumer, nil
}
Expand Down Expand Up @@ -108,6 +110,9 @@ func (nc *NSQConsumer) Run(c *consumer.ConsumerEntity) error {
}

func (nc *NSQConsumer) UpdateConfig(config *common.Config) {
// update nsqd connection config
nc.cfg = newNSQConfig(config, nc.consumerType)

etcdConfig := &etcdConfig{}
err := config.Unpack(etcdConfig)
if err != nil {
Expand Down

0 comments on commit 95f5fee

Please sign in to comment.