protected virtual async Task ServiceStop() { if (!_IsStopNeeded) { return; } try { _IsStopNeeded = false; await Task.WhenAny(_sssbService.Stop(), Task.Delay(TimeSpan.FromSeconds(30))); } catch (OperationCanceledException) { // NOOP } catch (PPSException) { throw; } catch (Exception ex) { _logger.LogError(ErrorHelper.GetFullMessage(ex)); throw new PPSException(ex); } finally { _sssbService.UnregisterMessageHandler(ONDEMAND_TASK_MESSAGE_TYPE); } }
protected virtual async Task ServiceStop() { if (!_IsStopNeeded) { return; } try { _IsStopNeeded = false; try { _scheduleManager.UnLoadSchedules(); } finally { var task2 = Task.WhenAny(_sssbService.Stop(), Task.Delay(TimeSpan.FromSeconds(30))); await task2; } } catch (OperationCanceledException) { // NOOP } catch (PPSException) { throw; } catch (Exception ex) { _logger.LogError(ErrorHelper.GetFullMessage(ex)); throw new PPSException(ex); } finally { _sssbService.UnregisterMessageHandler(SSSBMessage.EndDialogMessageType); } }