diff --git a/cron.txt b/cron.txt index 9833784c7..5a6a63b85 100644 --- a/cron.txt +++ b/cron.txt @@ -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 \ No newline at end of file +# 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 \ No newline at end of file diff --git a/src/FilterLists.Agent/Program.cs b/src/FilterLists.Agent/Program.cs index cb346366f..25fa6c975 100644 --- a/src/FilterLists.Agent/Program.cs +++ b/src/FilterLists.Agent/Program.cs @@ -21,7 +21,6 @@ public static int Main(string[] args) InstantiateTelemetryClient(); InstantiateServiceProvider(); - //TODO: capture batchSize from args const int batchSize = 1; CaptureSnapshots(batchSize); diff --git a/src/FilterLists.Services/SnapshotService/SnapshotService.cs b/src/FilterLists.Services/SnapshotService/SnapshotService.cs index 174b88707..5a4d9815b 100644 --- a/src/FilterLists.Services/SnapshotService/SnapshotService.cs +++ b/src/FilterLists.Services/SnapshotService/SnapshotService.cs @@ -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> 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()