Skip to content

Commit

Permalink
调整:asyncLocal自动释放功能
Browse files Browse the repository at this point in the history
  • Loading branch information
steden committed Jul 15, 2024
1 parent 0db4e65 commit d870e14
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions rabbitConsumer.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func (receiver *rabbitConsumer) Subscribe(queueName string, routingKey string, p
}
// 读取通道的消息
for page := range deliveries {
asyncLocal.GC()
asyncLocal.Release()
entryMqConsumer := receiver.manager.traceManager.EntryMqConsumer(page.CorrelationId, page.AppId, receiver.manager.config.Server, queueName, receiver.manager.config.RoutingKey)
args := receiver.createEventArgs(page, queueName)
exception.Try(func() {
Expand Down Expand Up @@ -88,7 +88,7 @@ func (receiver *rabbitConsumer) SubscribeAck(queueName string, routingKey string
}
// 读取通道的消息
for page := range deliveries {
asyncLocal.GC()
asyncLocal.Release()
entryMqConsumer := receiver.manager.traceManager.EntryMqConsumer(page.CorrelationId, page.AppId, receiver.manager.config.Server, queueName, receiver.manager.config.RoutingKey)
args := receiver.createEventArgs(page, queueName)
isSuccess := false
Expand Down Expand Up @@ -131,7 +131,7 @@ func (receiver *rabbitConsumer) SubscribeBatch(queueName string, routingKey stri
go func() {
var chl *amqp.Channel
for {
asyncLocal.GC()
asyncLocal.Release()
time.Sleep(500 * time.Millisecond)
// 创建一个连接和通道
var err error
Expand Down Expand Up @@ -172,7 +172,7 @@ func (receiver *rabbitConsumer) SubscribeBatchAck(queueName string, routingKey s
go func() {
var chl *amqp.Channel
for {
asyncLocal.GC()
asyncLocal.Release()
time.Sleep(100 * time.Millisecond)
// 创建一个连接和通道
var err error
Expand Down

0 comments on commit d870e14

Please sign in to comment.