If you create a new worker role, the template code creates the Run () method for you. In this Run () method, you will see the easiest way to create a timer:
while (true)
{
Thread.Sleep(10000);
Trace.WriteLine("Working", "Information");
}
So, in this example, the thread is sleeping for 10 seconds, then wakes up and emits a log statement. You can change the time interval to whatever you want, and then call any custom code after Thread.Sleep () returns.
source
share