Skip to content

Commit

Permalink
fix(producer): add logging + catch gone when reproducing
Browse files Browse the repository at this point in the history
  • Loading branch information
ArneD committed Oct 23, 2024
1 parent ba501bc commit f8bc7c6
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions src/BuildingRegistry.Producer.Snapshot.Oslo/SnapshotReproducer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
{
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using Be.Vlaanderen.Basisregisters.GrAr.Notifications;
Expand Down Expand Up @@ -55,10 +57,22 @@ protected override async Task ExecuteAsync(CancellationToken stoppingToken)
//reproduce
foreach (var id in idsToProcess)
{
await FindAndProduce(async () =>
await _osloProxy.GetSnapshot(id.PersistentLocalId.ToString(), stoppingToken),
id.Position,
stoppingToken);
try
{
await FindAndProduce(async () =>
await _osloProxy.GetSnapshot(id.PersistentLocalId.ToString(), stoppingToken),
id.Position,
stoppingToken);
}
catch (HttpRequestException e) when (e.StatusCode == HttpStatusCode.Gone)
{
_logger.LogInformation($"Snapshot '{id}' gone");
}
catch (Exception ex)
{
_logger.LogError($"Error while reproducing snapshot {id}", ex);
throw;
}
}

await Task.Delay(TimeSpan.FromHours(1), stoppingToken);
Expand Down

0 comments on commit f8bc7c6

Please sign in to comment.