try capture snapshots every minute with max of once per list per day

This commit is contained in:
Collin Barrett 2018-02-10 18:50:13 -06:00
parent a5a1ee93a3
commit 72a1368b7f
3 changed files with 8 additions and 4 deletions

View file

@ -1,2 +1,2 @@
# FilterLists - Capture Snapshots Hourly (skips if previous still running)
0 * * * * /usr/bin/flock -n /tmp/filterlistsagent.lockfile /var/www/filterlists/FilterLists.Agent > /dev/null 2>&1
# FilterLists - Try Capture Snapshots Every Minute (skips if previous still running)
*/1 * * * * /usr/bin/flock -n /tmp/filterlistsagent.lockfile /var/www/filterlists/FilterLists.Agent > /dev/null 2>&1

View file

@ -21,7 +21,6 @@ public static int Main(string[] args)
InstantiateTelemetryClient();
InstantiateServiceProvider();
//TODO: capture batchSize from args
const int batchSize = 1;
CaptureSnapshots(batchSize);

View file

@ -1,4 +1,5 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using AutoMapper.QueryableExtensions;
@ -39,6 +40,10 @@ private async Task<IEnumerable<FilterListViewUrlDto>> GetLeastRecentlyCapturedLi
.Select(y => y.CreatedDateUtc)
.OrderByDescending(y => y)
.FirstOrDefault())
.Where(x => x.Snapshots
.Select(y => y.CreatedDateUtc)
.OrderByDescending(y => y)
.FirstOrDefault() < DateTime.UtcNow.AddDays(-1))
.Take(batchSize)
.AsNoTracking()
.ProjectTo<FilterListViewUrlDto>()