Esempio n. 1
0
 public void Run(ITask currentTask, CancellationToken cancellationToken)
 {
     Task.Factory.StartNew(async() =>
     {
         _logger.LogTrace($"{typeof(TBot).Name}: Checking for updates...");
         await _botManager.GetAndHandleNewUpdatesAsync();
         _logger.LogTrace($"{typeof(TBot).Name}: Handling updates finished");
     }, cancellationToken).ContinueWith(task =>
     {
         if (task.IsFaulted)
         {
             throw task.Exception.InnerException;
         }
     }, cancellationToken);
 }
Esempio n. 2
0
 public void Run(ITask currentTask)
 {
     Task.Factory.StartNew(async() =>
     {
         _logger.LogTrace($"{typeof(TBot).Name}: Checking for updates...");
         await _botManager.GetAndHandleNewUpdatesAsync();
         _logger.LogTrace($"{typeof(TBot).Name}: Handling updates finished");
     }).ContinueWith(task =>
     {
         if (task.IsFaulted)
         {
             _logger.LogError("{0}", task.Exception.Message);
             throw task.Exception;
         }
     });
 }