Exemplo n.º 1
0
        /// <inheritdoc/>
        public void Handle(UmbracoApplicationStartingNotification notification)
        {
            if (_runtimeState.Level != RuntimeLevel.Run)
            {
                return;
            }

            if (_databaseFactory.CanConnect == false)
            {
                _logger.LogWarning("Cannot connect to the database, distributed calls will not be enabled for this server.");
                return;
            }

            // Sync on startup, this will run through the messenger's initialization sequence
            _messenger?.Sync();
        }
        public override Task PerformExecuteAsync(object state)
        {
            if (_runtimeState.Level != RuntimeLevel.Run)
            {
                return(Task.CompletedTask);
            }

            try
            {
                _messenger.Sync();
            }
            catch (Exception e)
            {
                _logger.LogError(e, "Failed (will repeat).");
            }

            return(Task.CompletedTask);
        }