awssub: remove message from queue in non concurrent way #88
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
After a message is handled by a client, the message is being removed via
subscriberMessage.Done()
method. The method sends to a channel a request to remove the message from a queue and that request will be handled by another goroutine in some indefinite time. The channel in our case is not buffered which blocks all callers of Done method till the previous request is handled.This in high load slows down the message handling a lot in a case if the messages are being handled concurrently.
In this PR I suggest to simplify the current solution, and instead of queuing up a request to remove a message, remove it synchronously by sending a request to sqs.
The current changes is backward compatible.