-
Notifications
You must be signed in to change notification settings - Fork 487
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FIx SQS: Error during Dapr Shutdown and Message Polling Behavior Issue (AWS) #3174
FIx SQS: Error during Dapr Shutdown and Message Polling Behavior Issue (AWS) #3174
Conversation
ff42f59
to
dc699b0
Compare
@amimimor looks like this PR is in a "broken" state where unrelated commits have been added to the branch. I'm not sure what happened. Could you please try fixing it before we can review it? |
Signed-off-by: Amit Mor <[email protected]>
Signed-off-by: Amit Mor <[email protected]> Signed-off-by: Amit Mor <[email protected]>
Signed-off-by: Amit Mor <[email protected]> Signed-off-by: Amit Mor <[email protected]>
Signed-off-by: Amit Mor <[email protected]> Signed-off-by: Amit Mor <[email protected]>
Signed-off-by: Amit Mor <[email protected]> Signed-off-by: Amit Mor <[email protected]>
first integration of subs mgmt
Signed-off-by: Amit Mor <[email protected]> Signed-off-by: Amit Mor <[email protected]>
Signed-off-by: Amit Mor <[email protected]> Signed-off-by: Amit Mor <[email protected]>
Signed-off-by: Amit Mor <[email protected]> Signed-off-by: Amit Mor <[email protected]>
Signed-off-by: Amit Mor <[email protected]>
Signed-off-by: Amit Mor <[email protected]> Signed-off-by: Amit Mor <[email protected]>
Signed-off-by: Amit Mor <[email protected]> Signed-off-by: Amit Mor <[email protected]>
Signed-off-by: Amit Mor <[email protected]>
dc699b0
to
ba0e5b5
Compare
should be now aligned. I had colab with a teammate and forgot to squash (as he is not DCOed) so I had to rebase like 17 commits back and probably made a mess. git keeps biting me 17yrs in the business |
I think most of us can relate 🤣 |
Signed-off-by: Amit Mor <[email protected]>
@@ -601,12 +606,13 @@ func (s *snsSqs) consumeSubscription(ctx context.Context, queueInfo, deadLetters | |||
// iteration. Therefore, a global backoff (to the internal backoff) is used (sqsPullExponentialBackoff). | |||
messageResponse, err := s.sqsClient.ReceiveMessageWithContext(ctx, receiveMessageInput) | |||
if err != nil { | |||
if err == context.Canceled || err == context.DeadlineExceeded { | |||
if errors.Is(err, context.Canceled) || errors.Is(err, context.DeadlineExceeded) || ctx.Err() != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if errors.Is(err, context.Canceled) || errors.Is(err, context.DeadlineExceeded) || ctx.Err() != nil { | |
if errors.Is(err, context.Canceled) || errors.Is(err, context.DeadlineExceeded) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why? the context might be cancelled while we pull messages but still haven't started a new for loop iteration (that verifies the ctx isn't cancelled, but just at the top of the loop)
Signed-off-by: Amit Mor <[email protected]> Signed-off-by: Amit Mor <[email protected]>
Signed-off-by: Amit Mor <[email protected]> Signed-off-by: Amit Mor <[email protected]>
Signed-off-by: Amit Mor <[email protected]> Signed-off-by: Amit Mor <[email protected]>
Signed-off-by: Amit Mor <[email protected]> Signed-off-by: Amit Mor <[email protected]>
Signed-off-by: Amit Mor <[email protected]> Signed-off-by: Amit Mor <[email protected]>
Signed-off-by: Amit Mor <[email protected]> Signed-off-by: Amit Mor <[email protected]>
Signed-off-by: Amit Mor <[email protected]>
Signed-off-by: Alessandro (Ale) Segala <[email protected]>
Signed-off-by: Amit Mor <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
thanks @ItalyPaleAle ! it wasn't an easy one and your comments had been very helpful. I'm now going to rush into adding documentation about the edge cases I came across with sns/sqs so that users could know what to expect. See you (maybe) in the coming PRs 🥳 |
Of course, thanks for the contribution and for your patience while we got this reviwwed :) Looking forward to see more good work from you! |
Description
In this PR, several significant changes have been made (please bear with me):
Subscribe
functionality, focusing on refining control constructs for categorizing messages by topic and ending short polling on SQS.SubscriptionManager
.SubscriptionManager
oversees a control goroutine loop, monitoring subscribe/unsubscribe operations and context terminations.Size
method that is used to determine what/if actions like halting of SQS consumption should be taken.Subscribe
creates a listener unsubscribe goroutine improving readability and the overall sense the system makes. As simple as "a subscribe creates an unsubscribe listener watching for subscribe context cancellation and acting upon it"Close
function.sync.Map
.Issue reference
We strive to have all PR being opened based on an issue, where the problem or feature have been discussed prior to implementation.
Please reference the issue this PR will close: #3156
Checklist
Please make sure you've completed the relevant tasks for this PR, out of the following list: