public async Task <IEnumerable <CheckNotification> > RunAsync(CancellationToken token) { var notifications = new List <CheckNotification>(); var skip = 0; var pageSize = Take; while (pageSize >= Take) { var checks = await _checkService.GetChecksAsync(skip, Take, asc : true, token : token); pageSize = checks.Count(); skip += pageSize; foreach (var check in checks) { var notification = await _checkNotificationService.CheckForNotificationAsync(check.Name, token); if (notification != null) { await SendAsync(check, notification, token); notifications.Add(notification); } } } return(notifications); }
public async Task <IEnumerable <Check> > GetChecksAsync( int skip = 0, int take = 10, bool asc = true, CancellationToken token = default(CancellationToken)) { var checks = await _checkService.GetChecksAsync(skip, take, asc, token); return(checks); }