Performing tasks at different intervals in the role of an azure worker

I have a simple Azure Worker role that runs a task every few seconds. Below is the code that executes this.

    public override void Run()
    {
        try
        {
            while (true)
            {
                DoSomething();
                System.Threading.Thread.Sleep(3000);
            }

        }
        catch (Exception ex)
        {
            Log.Add(ex, true);
        }            
    }

Now I would like to add a second DoSomethingElse () task, which fires once and only once a day. I thought of several ways to achieve this:

  • Add a counter that invokes a new task every nth cycle
  • Add conditional logic to a new task that compares the current time with a given time of day
  • Use some TBD scheduler library (e.g. Quartz.NET)

The first two solutions amaze me as very fragile, with no additional code, to cope with situations where the service stops and restarts. The third solution seems to me potentially redundant.

: Azure Worker? .NET ( ).

. № 3 #

+5
2

- , - , / .. , , .

( , sql azure ..). , , , . , .

, , .

+2
Windows Azure blob, , .
+1

All Articles