Example #1
0
 public void WorkerError(WorkerErrorEvent workerError)
 {
     if (_workerStates.TryGetValue(workerError.Language, out LanguageWorkerState erroredWorkerState))
     {
         erroredWorkerState.Errors.Add(workerError.Exception);
         bool isPreInitializedChannel = _languageWorkerChannelManager.ShutdownChannelIfExists(workerError.Language);
         if (!isPreInitializedChannel)
         {
             erroredWorkerState.Channel.Dispose();
         }
         RestartWorkerChannel(workerError.Language, erroredWorkerState);
     }
 }
Example #2
0
 public void WorkerError(WorkerErrorEvent workerError)
 {
     if (_workerStates.TryGetValue(workerError.Language, out LanguageWorkerState erroredWorkerState))
     {
         _logger.LogDebug($"Handling WorkerErrorEvent for runtime:{workerError.Language}");
         erroredWorkerState.Errors.Add(workerError.Exception);
         bool isPreInitializedChannel = _languageWorkerChannelManager.ShutdownChannelIfExists(workerError.Language);
         if (!isPreInitializedChannel)
         {
             _logger.LogDebug($"Disposing errored channel for workerId: {0}, for runtime:{1}", erroredWorkerState.Channel.Id, workerError.Language);
             erroredWorkerState.Channel.Dispose();
         }
         _logger.LogDebug($"Restarting worker channel for runtime:{0}", workerError.Language);
         RestartWorkerChannel(workerError.Language, erroredWorkerState);
     }
 }
 public async void WorkerError(WorkerErrorEvent workerError)
 {
     if (!_disposing)
     {
         _logger.LogDebug("Handling WorkerErrorEvent for runtime:{runtime}, workerId:{workerId}", workerError.Language, workerError.WorkerId);
         _workerState.Errors.Add(workerError.Exception);
         bool isPreInitializedChannel = _languageWorkerChannelManager.ShutdownChannelIfExists(workerError.Language, workerError.WorkerId);
         if (!isPreInitializedChannel)
         {
             _logger.LogDebug("Disposing errored channel for workerId: {channelId}, for runtime:{language}", workerError.WorkerId, workerError.Language);
             var erroredChannel = _workerState.GetChannels().Where(ch => ch.Id == workerError.WorkerId).FirstOrDefault();
             _workerState.DisposeAndRemoveChannel(erroredChannel);
         }
         _logger.LogDebug("Restarting worker channel for runtime:{runtime}", workerError.Language);
         await RestartWorkerChannel(workerError.Language, workerError.WorkerId);
     }
 }