Ejemplo n.º 1
0
        public void Dispose()
        {
            _standbySecretManager?.Dispose();
            _standbyHostManager?.Dispose();
            _standbyReceiverManager?.Dispose();

            _activeSecretManager?.Dispose();
            _activeHostManager?.Dispose();
            _activeReceiverManager?.Dispose();
        }
Ejemplo n.º 2
0
        private void EnsureInitialized(WebHostSettings settings)
        {
            // standby mode can only change from true to false
            // When standby mode changes, we reset all instances
            var standbyMode = WebScriptHostManager.InStandbyMode;

            if (!standbyMode)
            {
                if (_activeHostManager == null)
                {
                    if (_standbyHostManager != null)
                    {
                        // reintialize app settings if we were in standby
                        ReinitializeAppSettings();
                    }

                    _activeScriptHostConfig = GetScriptHostConfiguration(settings.ScriptPath, settings.LogPath);
                    _activeSecretManager    = GetSecretManager(settings.SecretsPath);
                    _activeReceiverManager  = new WebHookReceiverManager(_activeSecretManager);
                    _activeHostManager      = new WebScriptHostManager(_activeScriptHostConfig, _activeSecretManager, settings);

                    _standbySecretManager?.Dispose();
                    _standbyHostManager?.Dispose();
                    _standbyReceiverManager?.Dispose();

                    _standbyScriptHostConfig = null;
                    _standbySecretManager    = null;
                    _standbyHostManager      = null;
                    _standbyReceiverManager  = null;
                }
            }
            else
            {
                if (_standbyHostManager == null)
                {
                    _standbyScriptHostConfig = GetScriptHostConfiguration(settings.ScriptPath, settings.LogPath);
                    _standbySecretManager    = GetSecretManager(settings.SecretsPath);
                    _standbyReceiverManager  = new WebHookReceiverManager(_standbySecretManager);
                    _standbyHostManager      = new WebScriptHostManager(_standbyScriptHostConfig, _standbySecretManager, settings);
                }
            }
        }
Ejemplo n.º 3
0
        public static void Reset()
        {
            _standbySecretManager?.Dispose();
            _standbyHostManager?.Dispose();
            _standbyReceiverManager?.Dispose();

            _standbyScriptHostConfig = null;
            _standbySecretManager    = null;
            _standbyHostManager      = null;
            _standbyReceiverManager  = null;

            _activeSecretManager?.Dispose();
            _activeHostManager?.Dispose();
            _activeReceiverManager?.Dispose();

            _activeScriptHostConfig = null;
            _activeSecretManager    = null;
            _activeHostManager      = null;
            _activeReceiverManager  = null;
        }
Ejemplo n.º 4
0
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (_secretManager != null)
                {
                    _secretManager.Dispose();
                }
            }

            base.Dispose(disposing);
        }