Skip to content
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

Cancellation Token for Long polling in SQS #3861

Closed
2 tasks
E5presso opened this issue Sep 20, 2023 · 2 comments
Closed
2 tasks

Cancellation Token for Long polling in SQS #3861

E5presso opened this issue Sep 20, 2023 · 2 comments
Assignees
Labels
closed-for-staleness feature-request This issue requests a feature. response-requested Waiting on additional information or feedback. sqs

Comments

@E5presso
Copy link

E5presso commented Sep 20, 2023

Use Case

In documentation in boto3 for SQS, receive_message() function have "WaitTimeSeconds" parameter to activate long polling, So that we can save cost for calling API.

But since boto3 is non-async(synchronously executing) and blocking main thread,
When I set threading.Event or asyncio.Event to stop infinite loop for stopping background daemon task, receive_message() still waiting for next message (when queue is empty).
So, main service thread (like RESTful API Service) can't stop until boto3 receiving empty message, and finally stopped.

Proposed Solution

Add the Cancellation Token to receive_message() to send the signal that client don't need to wait for next message, and immediately stop.

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

SDK version used

boto3 1.28.43

Environment details (OS name and version, etc.)

macos Ventura, python 3.11.3 with poetry

@E5presso E5presso added feature-request This issue requests a feature. needs-triage This issue or PR still needs to be triaged. labels Sep 20, 2023
@tim-finnigan tim-finnigan self-assigned this Sep 21, 2023
@tim-finnigan
Copy link
Contributor

Hi @E5presso thanks for reaching out. The Boto3 receive_message command corresponds to the SQS ReceiveMessage API. So any feature requests involving the API would need to get forwarded to the SQS team. (If you have a support plan, we recommend reaching out through AWS Support for requests like this.) Otherwise you could create an issue in our cross-SDK repository and we could reach out to the service team on your behalf.

Alternatively if your request doesn't directly involve the API then it would still likely need to get rerouted to the cross-SDK repository for tracking, since we are striving to provide consistent functionality across SDKs.

I'll also share this Boto3 documentation on enabling long polling in case it is helpful: https://boto3.amazonaws.com/v1/documentation/api/latest/guide/sqs-example-long-polling.html. The request to support async is not under consideration until the next major version of Boto3.

@tim-finnigan tim-finnigan added response-requested Waiting on additional information or feedback. sqs and removed needs-triage This issue or PR still needs to be triaged. labels Sep 22, 2023
@github-actions
Copy link

Greetings! It looks like this issue hasn’t been active in longer than five days. We encourage you to check if this is still an issue in the latest release. In the absence of more information, we will be closing this issue soon. If you find that this is still a problem, please feel free to provide a comment or upvote with a reaction on the initial post to prevent automatic closure. If the issue is already closed, please feel free to open a new one.

@github-actions github-actions bot added closing-soon This issue will automatically close in 4 days unless further comments are made. closed-for-staleness and removed closing-soon This issue will automatically close in 4 days unless further comments are made. labels Sep 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-for-staleness feature-request This issue requests a feature. response-requested Waiting on additional information or feedback. sqs
Projects
None yet
Development

No branches or pull requests

2 participants