Timeout for scheduled tasks

I might be overthinking this, but when creating one-off scheduled tasks that will be long running, is there an option to set the timeout for the task?

Or should I just be using setting requesttimeout=long_long_time; within the task closure?

I assume you’re asking about ColdBox scheduled tasks? That’s a good question and I’m not sure if @lmajano has put anything in to limit the run of a task externally since that would require another thread to be monitoring. I’m also curious if the CF request timeouts are enforced on random threads running that aren’t specifically an HTTP request.

Sorry, yeah, should have clarified. Scheduled Tasks using the Async Manager.

1 Like

You don’t need a timeout because they are not CFML threads. They are using custom executor services and tasks are sent there. So no timeouts are necessary.

Awesome!

So, just to confirm that I’m understanding this right: tasks will run until they either complete or error.

Is that correct?

@lmajano I think whether a timeout is necessary is the decision of the developer, lol. The user story here would be

As a developer, I want to be able to limit the length of a long-running job so it doesn’t consume too many resources or hang indefinitely.

2 Likes

I’d second Brad on this one. Database hangs like LDEV-3659 are a good reason to have a timeout on a task.