Wednesday, October 21, 2020

Using TimerInfo object in Timer Functions

 TimerInfo object can be used to various purposes in a Timer Function. There are three main properties that can be used to make the logic. 


IsPastDue 

As I mentioned in the previous article this can be determined to know whether this function was scheduled to run previously. Depending on this you can decide to make certain actions. 


Schedule 

Schedule can be defined in the portal it self. Therefore the schedule may change from what we define in the function method header. Therefore this can be used to ensure the functionality reflects on the schedule it is meant to run. 

For example, you may have a daily data modification process defined and it can be a waste if mistakenly the schedule is changed. Therefore it can be checked. 


Schedule Status

This can be used to know the last run, current run initiated time as well as the next run scheduled time for a particular job. In an hourly scheduled scheduler, you can have different actions on odd hours and different on even hours although the best practices could mean to separate them to two functions.  

On the other hand if your scheduler is running more than its expected, you can determine that and pause the job or update a field based on that as the ScheduleStatus properties can be accessed throughout the. execution interval. 

No comments:

Post a Comment