-
Notifications
You must be signed in to change notification settings - Fork 863
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
SQS Timeouts not firing when using async ReceiveMessageAsync #609
Comments
How this came about: I was testing long polling and disconnecting myself from the internet... and something bad happened.....no timeouts. I would have expected the code to throw after some amount of time but it doesn't. It just sits there forever if I don't reconnect to the internet. When I use the normal sync APIs timeouts are thrown as you would expect. |
I'm using the following version of the librarys <?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="AWSSDK.Core" version="3.3.10.3" targetFramework="net452" />
<package id="AWSSDK.SQS" version="3.3.1.11" targetFramework="net452" />
</packages>
```
I'm also using .NET Framework 4.5.2
|
You would have to pass a
|
Yeah I came to the same conclusion, and added some code to catch the var recieveTimeout = new CancellationTokenSource(TimeSpan.FromSeconds(30));
ReceiveMessageResponse response;
try
{
var request = new ReceiveMessageRequest
{
QueueUrl = queueUrl,
MaxNumberOfMessages = 1,
WaitTimeSeconds = 20,
};
response = await sqs.ReceiveMessageAsync(request, recieveTimeout.Token);
}
catch (OperationCanceledException opEx)
{
if (opEx.CancellationToken == recieveTimeout.Token)
{
log.Warning("Timeout receiving messages.");
}
else
{
throw;
}
} I think there needs to be some documentation added about using CancellationTokenSource for all async code. |
We've updated the ClientConfig documentation to clarify the applicability of the timeout fields. Thanks for bringing this up. Closing this issue. |
Timeout exceptions are not being thrown when I configure the SQS client with a 10 second timeout, and a long polling time of 20 seconds. Here is the sample code:
The text was updated successfully, but these errors were encountered: