I have one azure storage table where I have a bunch of tasks to be completed by a worker role at a certain time. Example:
Task 1: -> run every 5 min
Task 2: -> run every 1 min
Task 3: -> run every 10 min
Task 4: -> run every 1 min
Task 5: -> run every 5 min
...........................
Task 1000: -> run every 1 min
Is this approach correct: Each task has a column DateTime called "LastRun". There is another column called "RunEvery" that stores the time when the task has to be executed. The worker role iterates through all tasks continuously and for each task checks the column "LastRun" with the following approach:
DateTime currentTime = DateTime.Now;
if (currentTime >= (myTask.LastRun + myTask.RunEvery))
{
myTask.Execute()
}
else
{
Check.Next.Task.InTable();
}
What about consuming resources if the worker role runs continuously? How we can spear resources? Or can I implement this in a better way? What is your advice?