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
|
|
@ -34,25 +34,20 @@ public static class SearchHistoryEndpoint
|
|||
{
|
||||
try
|
||||
{
|
||||
logger.LogInformation("SearchHistory {id} does not exist, adding it to the database", history._id);
|
||||
await repository.AddAsync(history, ct);
|
||||
}
|
||||
catch (Exception e)
|
||||
catch (Exception)
|
||||
{
|
||||
logger.LogError(e, "Failed to update history {json}", history._id);
|
||||
logger.LogError("Failed to update history {json}", history._id);
|
||||
return Results.StatusCode(500);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
await repository.UpdateAsync(history, ct);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
logger.LogError(e, "Failed to update history {json}", history._id);
|
||||
return Results.StatusCode(500);
|
||||
}
|
||||
logger.LogInformation("SearchHistory {id} exists, updating the database.", history._id);
|
||||
result.UpdateFrom(history);
|
||||
await repository.UpdateAsync(result, ct);
|
||||
}
|
||||
|
||||
return Results.Ok();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue