Home
Support Forums

Functions longer than 15 minutes

How do we handle a function that may take longer than 15 minutes? (15 minutes is the limit for background functions AFAIK). I have to update up to 2,000 records and don’t want the function to timeout.

My idea so far is to use recursion: Monitor how long the function is taking, then if the time is approaching 15 minutes, recursively call itself (to update the remaining records).

Can someone share their thoughts / experiences? I’m using Node JS.

Thanks

That’s one way to do it. Or if you have a fixed number of records like 2000, maybe you could make the function do 500 or 1000 in one call and then end itself and call the function again to do the remaining. Might be better than monitoring the time and calling the next one towards the end.

2 Likes

@hrishikesh That’s a good idea. Thanks!