コード例 #1
0
        public async Task OnTimeoutExceptionAsync(ExceptionDispatchInfo exceptionInfo, TimeSpan timeoutGracePeriod)
        {
            FunctionTimeoutException timeoutException = exceptionInfo.SourceException as FunctionTimeoutException;

            if (timeoutException?.Task != null)
            {
                // We may double the timeoutGracePeriod here by first waiting to see if the iniital
                // function task that started the exception has completed.
                Task completedTask = await Task.WhenAny(timeoutException.Task, Task.Delay(timeoutGracePeriod));

                // If the function task has completed, simply return. The host has already logged the timeout.
                if (completedTask == timeoutException.Task)
                {
                    return;
                }
            }

            LogErrorAndFlush("A function timeout has occurred. Host is shutting down.", exceptionInfo.SourceException);

            // We can't wait on this as it may cause a deadlock if the timeout was fired
            // by a Listener that cannot stop until it has completed.
            // TODO: DI (FACAVAL) The shutdown call will invoke the host stop... but we may need to do this
            // explicitly in order to pass the timeout.
            // Task ignoreTask = _hostManager.StopAsync();
            // Give the manager and all running tasks some time to shut down gracefully.
            //await Task.Delay(timeoutGracePeriod);

            _jobHostEnvironment.Shutdown();
        }
コード例 #2
0
 private async Task RestartWorkerChannel(string runtime, string workerId)
 {
     if (_languageWorkerErrors.Count < 3 * _maxProcessCount)
     {
         await InitializeJobhostLanguageWorkerChannelAsync(_languageWorkerErrors.Count);
     }
     else if (_jobHostLanguageWorkerChannelManager.GetChannels().Count() == 0)
     {
         _logger.LogError("Exceeded language worker restart retry count for runtime:{runtime}. Shutting down Functions Host", runtime);
         _scriptJobHostEnvironment.Shutdown();
     }
 }
コード例 #3
0
 private async Task RestartWorkerChannel(string workerId)
 {
     if (_invokerErrors.Count < 3)
     {
         await InitializeJobhostLanguageWorkerChannelAsync(_invokerErrors.Count);
     }
     else if (_httpWorkerChannel == null)
     {
         _logger.LogError("Exceeded http invoker restart retry count. Shutting down Functions Host");
         _scriptJobHostEnvironment.Shutdown();
     }
 }
コード例 #4
0
 private async Task RestartWorkerChannel(string workerId)
 {
     if (_invokerErrors.Count < 3)
     {
         _logger.LogDebug("Restarting http invoker channel");
         await InitializeHttpWorkerChannelAsync(_invokerErrors.Count);
     }
     else
     {
         _logger.LogError("Exceeded http worker restart retry count. Shutting down Functions Host");
         _scriptJobHostEnvironment.Shutdown();
     }
 }
コード例 #5
0
 private void Shutdown()
 {
     _scriptEnvironment.Shutdown();
 }
コード例 #6
0
 internal void Shutdown()
 {
     _scriptHostEnvironment.Shutdown();
 }