public LanguageWorkerState CreateWorkerState(string language) { ILanguageWorkerChannel initializedChannel = _languageWorkerChannelManager.GetChannel(language); if (initializedChannel != null) { return(CreateWorkerStateWithExistingChannel(language, initializedChannel)); } else { var state = new LanguageWorkerState(); WorkerConfig config = _workerConfigs.Where(c => c.Language.Equals(language, StringComparison.OrdinalIgnoreCase)).FirstOrDefault(); state.Channel = ChannelFactory(language, state.Functions, 0); _workerStates[language] = state; return(state); } }
public void Initialize(string workerRuntime, IEnumerable <FunctionMetadata> functions) { _languageWorkerChannelManager.ShutdownStandbyChannels(functions); if (Utility.IsSupportedRuntime(workerRuntime, _workerConfigs)) { ILanguageWorkerChannel initializedChannel = _languageWorkerChannelManager.GetChannel(workerRuntime); if (initializedChannel != null) { _logger.LogDebug("Found initialized language worker channel for runtime: {workerRuntime}", workerRuntime); CreateWorkerStateWithExistingChannel(workerRuntime, initializedChannel); } else { _logger.LogDebug("Creating new language worker channel for runtime:{workerRuntime}", workerRuntime); CreateWorkerState(workerRuntime); } } }
public void Initialize(string workerRuntime, IEnumerable <FunctionMetadata> functions) { _languageWorkerChannelManager.ShutdownStandbyChannels(functions); workerRuntime = workerRuntime ?? Utility.GetWorkerRuntime(functions); if (Utility.IsSupportedRuntime(workerRuntime, _workerConfigs)) { ILanguageWorkerChannel initializedChannel = _languageWorkerChannelManager.GetChannel(workerRuntime); if (initializedChannel != null) { CreateWorkerStateWithExistingChannel(workerRuntime, initializedChannel); } else { CreateWorkerState(workerRuntime); } } }