Feature request: Disable automatic retries for lambda invoke
See original GitHub issuetldr
When calling client.invoke
for lambda functions, I want to disable automatic retries upon timeout.
Steps to reproduce:
import boto3
import json
client = boto3.client('lambda')
response = client.invoke(
InvocationType='RequestResponse',
FunctionName='my_lambda',
LogType='Tail',
Payload=json.dumps({})
)
Where my_lambda
is configured to timeout after 100 seconds, but the code itself requires more time than that.
Desired behaviour
For my particular case, I want client.invoke
to return in no more than 100 seconds. If the function requires more than that, client.invoke
should raise a botocore.vendored.requests.exceptions.ReadTimeout
exception after 100 seconds (or maybe 101 seconds if you factor in overhead).
Observed Behaviour
client.invoke
raises the exception botocore.vendored.requests.exceptions.ReadTimeout
after 626 seconds. The CloudWatch logs show that the lambda function was invoked 8 times, even though client.invoke
was only called once.
(Yes, I know that (8-1) * 100 > 626. I’m confused by that too)
Justification
For this particular case, I know with certainty that if the lambda timed out the first time, it will time out the next 5 times also. So there’s no point retrying. I understand that normally automatic retries may be handy. So I propose that an option is added to client.invoke
, which allows you to disable automatic retries.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:5
- Comments:10 (2 by maintainers)
Top GitHub Comments
Looks like this was fixed with a cleaner solution in boto/botocore#1260:
this is my workaround about this issue