mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-13 11:11:30 -04:00
Process and read broker SQS messages more quickly
We're losing a lot of messages from the broker SQS queue because they are exceeding their maximum lifetime before being read and processed by the broker. This change speeds up that process by increasing the size of messagesChn and processing the messages within a go routine.
This commit is contained in:
parent
6384643109
commit
2250bc86f6
1 changed files with 5 additions and 3 deletions
|
@ -213,7 +213,7 @@ func newSQSHandler(context context.Context, client sqsclient.SQSClient, sqsQueue
|
|||
|
||||
func (r *sqsHandler) PollAndHandleMessages(ctx context.Context) {
|
||||
log.Println("SQSHandler: Starting to poll for messages at: " + *r.SQSQueueURL)
|
||||
messagesChn := make(chan *types.Message, 2)
|
||||
messagesChn := make(chan *types.Message, 20)
|
||||
go r.pollMessages(ctx, messagesChn)
|
||||
go r.cleanupClientQueues(ctx)
|
||||
|
||||
|
@ -223,8 +223,10 @@ func (r *sqsHandler) PollAndHandleMessages(ctx context.Context) {
|
|||
// if context is cancelled
|
||||
return
|
||||
default:
|
||||
r.handleMessage(ctx, message)
|
||||
r.deleteMessage(ctx, message)
|
||||
go func(msg *types.Message) {
|
||||
r.handleMessage(ctx, msg)
|
||||
r.deleteMessage(ctx, msg)
|
||||
}(message)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue