Sumant Agnihotri
Sumant Agnihotri

Reputation: 522

Stop sending requests multiple times due to timeout

I wrote a lambda function in Py 3.8 which goes something like this:

...
       if ext == 'pdf' or ext == 'PDF':
            resp = requests.get("http://...")
            return "Done"

Problem is requests.get takes more than 3 secs to respond, as a result, the function times out and requests.get is called again. How do I stop it from being called multiple times?

I don't mind the timeout, but I don't want it to get called again and again. Also: I can modify the API function which is being called if required.

Upvotes: 0

Views: 26

Answers (1)

omuthu
omuthu

Reputation: 6333

In the lambda Console, under Function configuration, you can modify the Retry attempts.

However, one of the core tenets of lambda is keep it stateless. Keeping functions stateless enables AWS Lambda to rapidly launch as many copies of the function as needed to scale to the rate of incoming events.

Upvotes: 1

Related Questions