public SpiderCheckManagerService ( SpiderCheckSettings settings, ISpiderRegularCheckService regularCheckService, IGlobalCheckInfoService globalCheckInfoService, ILogFactory logFactory ) { _dailyCheckTimeUtc = settings.DailyCheckTimeUtc; _globalCheckInfoService = globalCheckInfoService; _log = logFactory.CreateLog(this); if (_dailyCheckTimeUtc < TimeSpan.FromHours(0) || TimeSpan.FromHours(24) <= _dailyCheckTimeUtc) { throw new ArgumentException( $"Incorrect time of day at {nameof(settings)}.{nameof(settings.DailyCheckTimeUtc)}", nameof(settings)); } _regularCheckRepeatableTask = new RepeatableTask( regularCheckService.PerformRegularCheckAsync, settings.RegularCheckDurationToWarn, async ex => _log.Critical("Regular check", ex), async startTime => _log.Warning("Regular check", $"Regular check lasts more then {settings.RegularCheckDurationToWarn}. It starts at {startTime}") ); }
public SpiderRegularCheckService ( IGlobalCheckInfoService globalCheckInfoService, ICheckPersonResultDiffService diffService, ISpiderDocumentInfoRepository spiderDocumentInfoRepository, ICustomerChecksInfoRepository customerChecksInfoRepository, ISpiderCheckService spiderCheckService, ISpiderCheckResultRepository spiderCheckResultRepository, ISpiderCheckProcessingService spiderCheckProcessingService, ILogFactory logFactory ) { _globalCheckInfoService = globalCheckInfoService; _diffService = diffService; _spiderDocumentInfoRepository = spiderDocumentInfoRepository; _customerChecksInfoRepository = customerChecksInfoRepository; _spiderCheckService = spiderCheckService; _spiderCheckResultRepository = spiderCheckResultRepository; _spiderCheckProcessingService = spiderCheckProcessingService; _log = logFactory.CreateLog(this); }