public async Task SpecializeAsync()
        {
            _logger.LogInformation("Starting language worker channel specialization");
            _workerRuntime = _environment.GetEnvironmentVariable(LanguageWorkerConstants.FunctionWorkerRuntimeSettingName);

            ILanguageWorkerChannel languageWorkerChannel = await GetChannelAsync(_workerRuntime);

            if (_workerRuntime != null && languageWorkerChannel != null)
            {
                if (UsePlaceholderChannel(_workerRuntime))
                {
                    _logger.LogDebug("Loading environment variables for runtime: {runtime}", _workerRuntime);
                    await languageWorkerChannel.SendFunctionEnvironmentReloadRequest();
                }
                else
                {
                    _logger.LogDebug("Shutting down placeholder worker. Worker is not compatible for runtime: {runtime}", _workerRuntime);
                    // If we need to allow file edits, we should shutdown the webhost channel on specialization.
                    await ShutdownChannelIfExistsAsync(_workerRuntime, languageWorkerChannel.Id);
                }
            }

            _shutdownStandbyWorkerChannels();
            _logger.LogDebug("Completed language worker channel specialization");
        }
예제 #2
0
        public async Task SpecializeAsync()
        {
            _logger.LogInformation("Starting language worker channel specialization");
            _workerRuntime = _environment.GetEnvironmentVariable(LanguageWorkerConstants.FunctionWorkerRuntimeSettingName);
            ILanguageWorkerChannel languageWorkerChannel = GetChannel(_workerRuntime);

            if (_workerRuntime != null && languageWorkerChannel != null)
            {
                _logger.LogInformation("Loading environment variables for runtime: {runtime}", _workerRuntime);
                await languageWorkerChannel.SendFunctionEnvironmentReloadRequest();
            }
            _shutdownStandbyWorkerChannels();
        }
예제 #3
0
        public async Task SpecializeAsync()
        {
            _logger.LogInformation("Starting language worker channel specialization");
            _workerRuntime = _environment.GetEnvironmentVariable(LanguageWorkerConstants.FunctionWorkerRuntimeSettingName);
            ILanguageWorkerChannel languageWorkerChannel = GetChannel(_workerRuntime);

            if (_workerRuntime != null && languageWorkerChannel != null)
            {
                _logger.LogInformation("Loading environment variables for runtime: {runtime}", _workerRuntime);
                IObservable <WorkerProcessReadyEvent> processReadyEvents = _eventManager.OfType <WorkerProcessReadyEvent>()
                                                                           .Where(msg => string.Equals(msg.Language, _workerRuntime, StringComparison.OrdinalIgnoreCase))
                                                                           .Timeout(workerInitTimeout);
                languageWorkerChannel.SendFunctionEnvironmentReloadRequest();

                // Wait for response from language worker process
                await processReadyEvents.FirstAsync();
            }
            _shutdownStandbyWorkerChannels();
        }