コード例 #1
0
ファイル: WardenManager.cs プロジェクト: wushian/Warden
        /// <summary>
        /// Start the Warden Manager using the underlying IWarden instance.
        /// </summary>
        /// <returns></returns>
        public async Task StartAsync()
        {
            _logger.Info("Starting Warden Manager.");
            _isManagerRunning = true;
            _isWardenRunning  = true;
            await _warden.StartAsync();

            while (_isManagerRunning)
            {
                await Task.Delay(1000);

                if (_isWardenRunning)
                {
                    continue;
                }

                _logger.Trace("Warden has been stopped, awaiting for the start command...");
            }
        }
コード例 #2
0
ファイル: IIterationProcessor.cs プロジェクト: wushian/Warden
        private async Task InvokeAggregatedOnSuccessHooksAsync(IEnumerable <WatcherExecutionResult> results)
        {
            var validResults = results.Select(x => x.WardenCheckResult).Where(x => x.IsValid);

            _logger.Trace("Executing Aggregated Global Watcher hooks OnSuccess.");
            _configuration.AggregatedGlobalWatcherHooks.OnSuccess.Execute(validResults);
            _logger.Trace("Executing Aggregated Global Watcher hooks OnSuccessAsync.");
            await _configuration.AggregatedGlobalWatcherHooks.OnSuccessAsync.ExecuteAsync(validResults);
        }
コード例 #3
0
ファイル: Warden.cs プロジェクト: weiplanet/Warden
        /// <summary>
        /// Start the Warden.
        /// It will be running iterations in a loop (infinite by default but can be changed) and executing all of the configured hooks.
        /// </summary>
        /// <returns></returns>
        public async Task StartAsync()
        {
            _logger.Info($"Starting Warden: {Name}");
            _running = true;
            _logger.Trace("Executing Warden hooks OnStart.");
            _configuration.Hooks.OnStart.Execute();
            _logger.Trace("Executing Warden hooks OnStartAsync.");
            await _configuration.Hooks.OnStartAsync.ExecuteAsync();

            await TryExecuteIterationsAsync();
        }