예제 #1
0
        internal async Task DelayUntilWokerInitialized(CancellationToken cancellationToken)
        {
            using (_metricsLogger.LatencyEvent(MetricEventNames.DelayUntilWorkerIsInitialized))
            {
                _workerChannelLogger.LogDebug("Initializing HttpWorker.");
                try
                {
                    bool isWorkerReady = await _httpWorkerService.IsWorkerReady(cancellationToken);

                    if (!isWorkerReady)
                    {
                        throw new TimeoutException("Initializing HttpWorker timed out.");
                    }
                    else
                    {
                        _workerChannelLogger.LogDebug("HttpWorker is Initialized.");
                    }
                }
                catch (Exception ex)
                {
                    // HttpFunctionInvocationDispatcher will handdle the worker error events
                    _workerChannelLogger.LogError(ex, "Failed to start http worker process. workerId:{id}", Id);
                    PublishWorkerErrorEvent(ex);
                    throw;
                }
            }
        }
        internal async Task DelayUntilWokerInitialized(CancellationToken cancellationToken)
        {
            _workerChannelLogger.LogDebug("Initializing HttpWorker.");
            try
            {
                bool isWorkerReady = await _httpWorkerService.IsWorkerReady(cancellationToken);

                if (!isWorkerReady)
                {
                    PublishWorkerErrorEvent(new TimeoutException("Initializing HttpWorker timed out."));
                }
                else
                {
                    _workerChannelLogger.LogDebug("HttpWorker is Initialized.");
                }
            }
            catch (Exception ex)
            {
                // HttpFunctionInvocationDispatcher will handdle the worker error events
                PublishWorkerErrorEvent(ex);
            }
        }