How can we schedules long running backend job in forge

Hi Team,

I have recently started working on Forge development and I’m currently building a sample app based on the official tutorials. My goal is to create a scheduled job that retrieves all project details along with their associated custom fields. Additionally, for each field, the job should check whether the field context is shared or non-shared, and store this information into the project properties.

However, in our case, we have a large number of projects and fields, and the scheduled job is hitting timeout issues when processing all of them in a single run.

Could you please advise if there are best practices or strategies in Forge to handle long-running scheduled jobs efficiently? Specifically, I’m interested in how to split the workload or manage batching within Forge to avoid timeout errors during such extensive operations.

Hi,

This is possible by using Async Events.
Schedule trigger can trigger Async events and Async events can run up to 15mins (by setting a timeout value).

Good luck on your Forge Journey.

Cheers
Ben

Hi Benny,

Thanks for your response and suggestion. But my job is taking 4-6 hours to complete, so i want this as background job. So what would be the best way to deal with?

You need to slice the work into smaller 15min pieces and execute them in series, using Forge KVS as a data store to store intermediate data as the processing completes.

This session from Atlas Camp describes some approaches you can use: https://www.youtube.com/watch?v=-ujdWIyFu0I