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
|
|
@ -33,22 +33,21 @@ public static class ProfileEndpoint
|
|||
{
|
||||
try
|
||||
{
|
||||
logger.LogInformation("Profile {id} does not exist, adding it to the database", profile._id);
|
||||
await repository.AddAsync(profile, ct);
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (Exception)
|
||||
{
|
||||
logger.LogError(ex, "Failed to create profile {json}", profile._id);
|
||||
logger.LogError("Failed to create profile {json}", profile._id);
|
||||
return Results.StatusCode(500);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.LogInformation("Profile {id} exists, updating the database.", profile._id);
|
||||
res.UpdateFrom(profile);
|
||||
var toRemove = res.subscriptions.Where(sub => !profile.subscriptions.Any(x => x.id == sub.id)).ToList();
|
||||
|
||||
res.name = profile.name;
|
||||
res.textColor = profile.textColor;
|
||||
res.bgColor = profile.bgColor;
|
||||
|
||||
foreach (var sub in toRemove)
|
||||
res.subscriptions.Remove(sub);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue