Skip to content

Commit

Permalink
新增:asyncLocal.GC功能。用于主动清除
Browse files Browse the repository at this point in the history
  • Loading branch information
steden committed Apr 10, 2024
1 parent 6578850 commit 7688903
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions rabbitConsumer.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package rabbit

import (
"github.com/farseer-go/collections"
"github.com/farseer-go/fs/asyncLocal"
"github.com/farseer-go/fs/exception"
"github.com/farseer-go/fs/flog"
amqp "github.com/rabbitmq/amqp091-go"
Expand Down Expand Up @@ -54,6 +55,7 @@ func (receiver *rabbitConsumer) Subscribe(queueName string, routingKey string, p
}
// 读取通道的消息
for page := range deliveries {
asyncLocal.GC()

Check failure on line 58 in rabbitConsumer.go

View workflow job for this annotation

GitHub Actions / build

undefined: asyncLocal.GC
entryMqConsumer := receiver.manager.traceManager.EntryMqConsumer(receiver.manager.config.Server, queueName, receiver.manager.config.RoutingKey)
args := receiver.createEventArgs(page, queueName)
exception.Try(func() {
Expand Down Expand Up @@ -85,6 +87,7 @@ func (receiver *rabbitConsumer) SubscribeAck(queueName string, routingKey string
}
// 读取通道的消息
for page := range deliveries {
asyncLocal.GC()

Check failure on line 90 in rabbitConsumer.go

View workflow job for this annotation

GitHub Actions / build

undefined: asyncLocal.GC
entryMqConsumer := receiver.manager.traceManager.EntryMqConsumer(receiver.manager.config.Server, queueName, receiver.manager.config.RoutingKey)
args := receiver.createEventArgs(page, queueName)
isSuccess := false
Expand Down Expand Up @@ -127,6 +130,7 @@ func (receiver *rabbitConsumer) SubscribeBatch(queueName string, routingKey stri
go func() {
var chl *amqp.Channel
for {
asyncLocal.GC()

Check failure on line 133 in rabbitConsumer.go

View workflow job for this annotation

GitHub Actions / build

undefined: asyncLocal.GC
time.Sleep(500 * time.Millisecond)
entryMqConsumer := receiver.manager.traceManager.EntryMqConsumer(receiver.manager.config.Server, queueName, receiver.manager.config.RoutingKey)
// 创建一个连接和通道
Expand Down Expand Up @@ -166,6 +170,7 @@ func (receiver *rabbitConsumer) SubscribeBatchAck(queueName string, routingKey s
go func() {
var chl *amqp.Channel
for {
asyncLocal.GC()

Check failure on line 173 in rabbitConsumer.go

View workflow job for this annotation

GitHub Actions / build

undefined: asyncLocal.GC
time.Sleep(100 * time.Millisecond)
entryMqConsumer := receiver.manager.traceManager.EntryMqConsumer(receiver.manager.config.Server, queueName, receiver.manager.config.RoutingKey)
// 创建一个连接和通道
Expand Down

0 comments on commit 7688903

Please sign in to comment.