don't re-snapshot lists with fixed archive urls

ref #325
This commit is contained in:
Collin M. Barrett 2018-08-24 13:12:29 -05:00
parent 9162feccf7
commit 82de6487e4
2 changed files with 8 additions and 1 deletions

View file

@ -6,6 +6,7 @@
using AutoMapper.QueryableExtensions;
using FilterLists.Data;
using FilterLists.Services.Snapshot.Models;
using FilterLists.Services.Wayback;
using Microsoft.EntityFrameworkCore;
namespace FilterLists.Services.Snapshot
@ -37,7 +38,12 @@ await DbContext
l.Snapshots
.Select(s => s.CreatedDateUtc)
.OrderByDescending(d => d)
.First() < yesterday))
.First() < yesterday &&
!l.Snapshots
.First()
.FilterList
.ViewUrl
.StartsWith(WaybackService.WaybackMachineUrlPrefix)))
.OrderBy(l => l.Snapshots.Any())
.ThenBy(l => l.Snapshots
.OrderByDescending(s => s.CreatedDateUtc)

View file

@ -9,6 +9,7 @@ namespace FilterLists.Services.Wayback
{
public static class WaybackService
{
public const string WaybackMachineUrlPrefix = "https://web.archive.org/web/";
private const string WaybackAvailabilityApiUrlPrefix = "https://archive.org/wayback/available?url=";
public static async Task<SnapshotMetaDto> GetMostRecentSnapshotMeta(string url)