1

I want to build an API where end user can set timeout. Not to be confused with the usual timeout setting in serverless.yml file.

def main(event, context):
    timeout=event["timeout"] # use this

1 Answer 1

2

One solution would be to globally configure your lambda functions to time out at the maximum (15 minutes, currently).

Then your handler would need to fork your lambda process, and have the parent process kill the child process (which is where your actual application code will be) after the user-specified amount of time.

Sign up to request clarification or add additional context in comments.

1 Comment

Here's an example from stack overflow: stackoverflow.com/questions/1359383/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.