private void RunTaskAsync(TaskEntry task) { Invariants.Assert(ReferenceEquals(_runningTask, task)); _customThreadPool.RunAsync(() => { Invariants.Assert(ReferenceEquals(_runningTask, task)); try { if (Logger.IsDebugEnabled) { Logger.LogDebug("Queue \"{0}\": Executing task \"{1}\" after waiting for {2:n0} msec", _description, task.Id.Description, (_dateTimeProvider.UtcNow - task.EnqueuedDateTimeUtc).TotalMilliseconds); } task.StopWatch.Start(); task.Action(_taskCancellationTracker.NewToken()); } finally { Invariants.Assert(ReferenceEquals(_runningTask, task)); task.StopWatch.Stop(); if (Logger.IsDebugEnabled) { Logger.LogDebug("Queue \"{0}\": Executed task \"{1}\" in {2:n0} msec", _description, task.Id.Description, task.StopWatch.ElapsedMilliseconds); } RunNextTaskIfAvailableAsync(task); } }); }
private void RunTaskAsync(TaskEntry entry) { _customThreadPool.RunAsync(() => { try { Logger.LogInfo("Queue \"{0}\": Executing task \"{1}\" after waiting for {2:n0} msec", _description, entry.Id.Description, (_dateTimeProvider.UtcNow - entry.EnqueuedDateTimeUtc).TotalMilliseconds); entry.StopWatch.Start(); entry.Action(); } finally { OnTaskFinished(entry); } }); }
private void RunTaskAsync(TaskEntry entry) { _customThreadPool.RunAsync(() => { try { Logger.LogInfo("Queue \"{0}\": Executing task \"{1}\" after waiting for {2:n0} msec", _description, entry.Id.Description, (_dateTimeProvider.UtcNow - entry.EnqueuedDateTimeUtc).TotalMilliseconds); entry.StopWatch.Start(); entry.Action(); } finally { OnTaskFinished(entry); } }); }
private void RunTaskAsync(TaskEntry entry) { _customThreadPool.RunAsync(() => { try { if (Logger.IsDebugEnabled) { Logger.LogDebug("Queue \"{0}\": Executing task \"{1}\" after waiting for {2:n0} msec", _description, entry.Id.Description, (_dateTimeProvider.UtcNow - entry.EnqueuedDateTimeUtc).TotalMilliseconds); } entry.StopWatch.Start(); entry.Action(_taskCancellationTracker.NewToken()); } finally { OnTaskFinished(entry); } }); }