Candor.Tasks.RepeatingWorkerRoleTask.Ping C# (CSharp) Method

Ping() public method

Pings the task to ensure that it is running.
public Ping ( ) : void
return void
        public override void Ping()
        {
            if (_disposed)
                throw new ObjectDisposedException("WorkerRole");
            if (_iterationRunning)
            {
                LogProvider.DebugFormat("Running iteration for '{1}' now, next due is {0:yyyy-MM-dd HH:mm:ss}", _nextIterationTimestamp, Name);
            }
            if (_lastCheckIn.AddSeconds(Math.Min(30, WaitingPeriodSeconds * 2)) < DateTime.UtcNow
                && _nextIterationTimestamp.AddSeconds(Math.Min(30, WaitingPeriodSeconds * 2)) < DateTime.UtcNow)
            {   //if behind by a normal iteration duration, then restart the timer
                LogProvider.WarnFormat("Task timer is being restarted for '{1}' due to next iteration not firing on time, Last CheckIn: {0:yyyy-MM-dd HH:mm:ss}. Now: {2:yyyy-MM-dd HH:mm:ss}", _lastCheckIn, Name, DateTime.UtcNow);
                ResetTimer();
            }
            else
                LogProvider.DebugFormat("Next iteration for '{1}' due by {0:yyyy-MM-dd HH:mm:ss}", _nextIterationTimestamp, Name);
        }