protected override async Task RunAsync(CancellationToken cancellation) { Configure(container); var workerName = GetType().FullName; logger.Info("[ServiceStack.Webhooks.Azure.Worker.AzureWorkerServiceEntryPoint] {0}.Running".Fmt(workerName)); try { await WorkerRunner.RunContinuouslyAsync(logger, Workers.ToList(), cancellation); } catch (OperationCanceledException) { logger.Info("[ServiceStack.Webhooks.Azure.Worker.AzureWorkerServiceEntryPoint] {0}.Interrupted".Fmt(workerName)); // Ignore the exception to allow worker to shutdown gracefully } }
public override void Run() { var workerName = GetType().FullName; logger.Info("[ServiceStack.Webhooks.Azure.Worker.AzureWorkerRoleEntryPoint] {0}.Running".Fmt(workerName)); try { WorkerRunner.RunOnceAsync(logger, Workers.ToList(), cancellationTokenSource.Token) .Wait(cancellationTokenSource.Token); } catch (OperationCanceledException) { logger.Info("[ServiceStack.Webhooks.Azure.Worker.AzureWorkerRoleEntryPoint] {0}.Interrupted".Fmt(workerName)); // Ignore the exception to allow worker to shutdown gracefully } finally { runCompleteEvent.Set(); } }