mirror of
https://github.com/collinbarrett/FilterLists.git
synced 2026-03-11 09:04:27 +00:00
parent
c6c41bf671
commit
aebc3f336c
2 changed files with 5 additions and 2 deletions
|
|
@ -25,6 +25,7 @@ public class Snapshot
|
|||
private readonly string uaString;
|
||||
private HashSet<string> lines;
|
||||
protected string ListUrl;
|
||||
private bool wasWebException;
|
||||
|
||||
public Snapshot()
|
||||
{
|
||||
|
|
@ -43,7 +44,7 @@ public Snapshot(BatchSizeService batchSizeService, FilterListsDbContext dbContex
|
|||
telemetryClient = new TelemetryClient();
|
||||
}
|
||||
|
||||
public bool WasSuccessful => SnapEntity.WasSuccessful;
|
||||
public bool RetryMirror => !SnapEntity.WasSuccessful && wasWebException;
|
||||
|
||||
public virtual async Task TrySaveAsync() => await TrySaveAsyncBase();
|
||||
|
||||
|
|
@ -86,11 +87,13 @@ private async Task TryGetLines()
|
|||
}
|
||||
catch (HttpRequestException hre)
|
||||
{
|
||||
wasWebException = true;
|
||||
await dbContext.SaveChangesAsync();
|
||||
TrackException(hre);
|
||||
}
|
||||
catch (WebException we)
|
||||
{
|
||||
wasWebException = true;
|
||||
SnapEntity.HttpStatusCode = (int)((HttpWebResponse)we.Response).StatusCode;
|
||||
await dbContext.SaveChangesAsync();
|
||||
TrackException(we);
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ public async Task CaptureAsync(int batchSize)
|
|||
uaString = await UserAgentService.GetMostPopularString();
|
||||
var lists = await GetListsToCapture(batchSize);
|
||||
var snaps = await CreateAndSaveSnaps<Snapshot>(lists);
|
||||
var listsToRetry = snaps.Where(s => !s.WasSuccessful).Select(s => s.List);
|
||||
var listsToRetry = snaps.Where(s => s.RetryMirror).Select(s => s.List);
|
||||
await CreateAndSaveSnaps<SnapshotWayback>(listsToRetry);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue