Hello,
Could anyone provide a sample code/oml for processing large datasets using timers, along with some theoretical explanation of how to do it?
If there are multiple ways to achieve this, please suggest them as well."
i want to understand what is written in those 2 if conditions
Hi Suresh Kumar,
Good Morning.
Timer:
A Timer is an OutSystems tool that allows executing application logic periodically on a scheduled time. These are also known as batch jobs.
Different Timers can be executed at the same time, but the same Timer never has more than one execution at a time.
Using Timers:
You can use Timers to execute asynchronous logic in your OutSystems application. This is useful to execute batch tasks like sending emails at a predetermined time or to execute logic to configure an application after its deployment.
Timers Timeout
The timeout of a Timer is set by default to 20 minutes, but you can change it by setting the Timeout in Minutes property of the timer.
Here's a simplified Steps of the logic you're describing:
1) Set Timer Timeout: The default timeout is 20 minutes, but you can adjust this to a custom timeout (e.g., 10 minutes). This is used to ensure that the timer is restarted before it hits the timeout limit. Essentially, this would prevent the timer from being interrupted by a timeout before completing its logic.
2) Fetch Records: Retrieve records from an entity (e.g., 1000 records) to process. This step could involve querying a database or API for the necessary data.
3) Process Each Record: Iterate through each record and process it. Update the status or flag of the record to mark it as processed, ensuring no record is processed more than once.
4) Check Timeout: Evaluate if the timer has exceeded the set timeout. If the timeout is near, restart the timer to avoid an interruption. This ensures that the timer doesn't end prematurely.
5) Check for More Records: If more records need processing, redirect to Step 2 and continue the process. If no more records are left to process, the timer ends and completes the job.
This is useful in scenarios like batch processing, ensuring tasks that take longer than the typical execution time don't fail, and minimizing the risk of duplicate processing.
For further more details, kindly refer this link for timers.
Thanks.
The 2 if condition are as below
Timeout passed
The second is more records to Process
Hope that helps.
Regards
Subu
Hi @Suresh kumar ,
Watch this explanatory video on Heavy Timers, which covers best practices for using them effectively: https://learn.outsystems.com/training/journeys/odc-2018-development-548/-odc-2018-heavy-timers/o11/2480 .