Best way to prevent a timer from timing out?
Question

I know that we should process in batches and get out of the loop before the timeout reaches and wake the timer again. My question is to keep track of the already processed records. Should i create an entity that has the Id of the entity im working on and a 2nd field IsProcessed? Or are there better ways to handle it?

Solution

Hi Tony,

Yes, your approach is correct. Please update the processed record's status as "P" (Processed) into the entity. 

Also, if it's possible in your scenario mark the record's status as "N" (New") prior to scheduler runs to fetch the unprocessed records, so it will pull only the records whose status are "N" and once it get processed the status will get update to "P".  This process might save time and process all the records with in the schedule time.

Thanks & Kind Regards,

Sachin

Hi,

In some scenarios it's possible to look to the "LastUpdateDateTime" attribute of your entity (if that attribute exist or something similar) and just process that ones that last update is before your timer runs (you can calculate that or just store that value). 


Hope this can help.


Best regards,

Ricardo Pereira

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.