mirror of
https://github.com/eventials/goevents.git
synced 2025-04-24 13:48:53 +08:00
Remove useless code
This commit is contained in:
parent
8231c14ac1
commit
bf9ff86a03
@ -30,7 +30,6 @@ type producer struct {
|
|||||||
channel *amqplib.Channel
|
channel *amqplib.Channel
|
||||||
notifyConfirm chan amqplib.Confirmation
|
notifyConfirm chan amqplib.Confirmation
|
||||||
notifyChanClose chan *amqplib.Error
|
notifyChanClose chan *amqplib.Error
|
||||||
closeQueue chan bool
|
|
||||||
config ProducerConfig
|
config ProducerConfig
|
||||||
|
|
||||||
internalQueue chan message
|
internalQueue chan message
|
||||||
@ -62,7 +61,6 @@ func NewProducerConfig(c messaging.Connection, exchange string, config ProducerC
|
|||||||
config: config,
|
config: config,
|
||||||
internalQueue: make(chan message, 2),
|
internalQueue: make(chan message, 2),
|
||||||
exchangeName: exchange,
|
exchangeName: exchange,
|
||||||
closeQueue: make(chan bool),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
err := producer.setupTopology()
|
err := producer.setupTopology()
|
||||||
@ -127,10 +125,7 @@ func (p *producer) Close() {
|
|||||||
|
|
||||||
p.wg.Wait()
|
p.wg.Wait()
|
||||||
|
|
||||||
p.closeQueue <- true
|
|
||||||
|
|
||||||
close(p.internalQueue)
|
close(p.internalQueue)
|
||||||
close(p.closeQueue)
|
|
||||||
|
|
||||||
p.channel.Close()
|
p.channel.Close()
|
||||||
|
|
||||||
@ -333,11 +328,7 @@ func (p *producer) isClosed() bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (p *producer) drainInternalQueue() {
|
func (p *producer) drainInternalQueue() {
|
||||||
for {
|
for m := range p.internalQueue {
|
||||||
select {
|
|
||||||
case <-p.closeQueue:
|
|
||||||
return
|
|
||||||
case m := <-p.internalQueue:
|
|
||||||
retry := true
|
retry := true
|
||||||
|
|
||||||
for retry {
|
for retry {
|
||||||
@ -362,4 +353,3 @@ func (p *producer) drainInternalQueue() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user