Exemple #1
0
        public async Task SpecializeHostCoreAsync()
        {
            // Go async immediately to ensure that any async context from
            // the PlaceholderSpecializationMiddleware is properly suppressed.
            await Task.Yield();

            _logger.LogInformation(Resources.HostSpecializationTrace);

            // After specialization, we need to ensure that custom timezone
            // settings configured by the user (WEBSITE_TIME_ZONE) are honored.
            // DateTime caches timezone information, so we need to clear the cache.
            TimeZoneInfo.ClearCachedData();

            // Trigger a configuration reload to pick up all current settings
            _configuration?.Reload();

            _hostNameProvider.Reset();

            await _languageWorkerChannelManager.SpecializeAsync();

            NotifyChange();
            await _scriptHostManager.RestartHostAsync();

            await _scriptHostManager.DelayUntilHostReady();
        }
        public async Task SpecializeHostCoreAsync()
        {
            // Go async immediately to ensure that any async context from
            // the PlaceholderSpecializationMiddleware is properly suppressed.
            await Task.Yield();

            _logger.LogInformation(Resources.HostSpecializationTrace);

            // After specialization, we need to ensure that custom timezone
            // settings configured by the user (WEBSITE_TIME_ZONE) are honored.
            // DateTime caches timezone information, so we need to clear the cache.
            TimeZoneInfo.ClearCachedData();

            // Trigger a configuration reload to pick up all current settings
            _configuration?.Reload();

            _hostNameProvider.Reset();

            // Reset the shared load context to ensure we're reloading
            // user dependencies
            FunctionAssemblyLoadContext.ResetSharedContext();

            // Signals change of JobHost options from placeholder mode
            // (ex: ScriptPath is updated)
            NotifyChange();

            using (_metricsLogger.LatencyEvent(MetricEventNames.SpecializationLanguageWorkerChannelManagerSpecialize))
            {
                await _rpcWorkerChannelManager.SpecializeAsync();
            }

            using (_metricsLogger.LatencyEvent(MetricEventNames.SpecializationRestartHost))
            {
                await _scriptHostManager.RestartHostAsync();
            }

            using (_metricsLogger.LatencyEvent(MetricEventNames.SpecializationDelayUntilHostReady))
            {
                await _scriptHostManager.DelayUntilHostReady();
            }
        }