Looks like we finally have a solution.
Change logging to just log a message, instead of the exception. Moved logic to Syncer involvement. When posting the data, if a 500 is returned, then it is up to the Syncer to re-submit it.
This commit is contained in:
parent
73955353cb
commit
004c490dd8
23 changed files with 529 additions and 177 deletions
|
|
@ -32,25 +32,22 @@ public static class HistoryEndpoint
|
|||
{
|
||||
try
|
||||
{
|
||||
logger.LogInformation("History {id} does not exist, adding it to the database Thread: {thread}",
|
||||
history._id, Thread.CurrentThread.ManagedThreadId);
|
||||
await repository.AddAsync(history, ct);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.LogError(ex, "Failed to create history {json}", history._id);
|
||||
logger.LogError("Failed to create history {json}", history._id);
|
||||
return Results.StatusCode(500);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
await repository.UpdateAsync(history, ct);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.LogError(ex, "Failed to update history {json}", history._id);
|
||||
return Results.StatusCode(500);
|
||||
}
|
||||
logger.LogInformation("History {id} exists, updating the database. Thread: {thread}", history._id,
|
||||
Thread.CurrentThread.ManagedThreadId);
|
||||
results.UpdateFrom(history);
|
||||
await repository.UpdateAsync(results, ct);
|
||||
}
|
||||
return Results.Ok();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue