[backend/core] Catch errors in NoteService.ResolveNoteAsync
This fixes some inbox job failures, for example when a post quoting a deleted post is being ingested.
This commit is contained in:
parent
b5ad7649ea
commit
0962b07021
2 changed files with 12 additions and 1 deletions
|
@ -185,7 +185,7 @@ public class ActivityFetcherService(
|
||||||
if (!response.IsSuccessStatusCode)
|
if (!response.IsSuccessStatusCode)
|
||||||
{
|
{
|
||||||
if (response.StatusCode == HttpStatusCode.Gone)
|
if (response.StatusCode == HttpStatusCode.Gone)
|
||||||
throw AuthFetchException.NotFound("The remote user no longer exists.");
|
throw AuthFetchException.NotFound("The remote object no longer exists.");
|
||||||
logger.LogDebug("Failed to fetch activity: response status was {code}", response.StatusCode);
|
logger.LogDebug("Failed to fetch activity: response status was {code}", response.StatusCode);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
|
using System.Net;
|
||||||
using AsyncKeyedLock;
|
using AsyncKeyedLock;
|
||||||
using Iceshrimp.Backend.Core.Configuration;
|
using Iceshrimp.Backend.Core.Configuration;
|
||||||
using Iceshrimp.Backend.Core.Database;
|
using Iceshrimp.Backend.Core.Database;
|
||||||
|
@ -1141,6 +1142,16 @@ public class NoteService(
|
||||||
var id = e.Uri[$"https://{config.Value.WebDomain}/notes/".Length..];
|
var id = e.Uri[$"https://{config.Value.WebDomain}/notes/".Length..];
|
||||||
return await db.Notes.IncludeCommonProperties().FirstOrDefaultAsync(p => p.Id == id);
|
return await db.Notes.IncludeCommonProperties().FirstOrDefaultAsync(p => p.Id == id);
|
||||||
}
|
}
|
||||||
|
catch (AuthFetchException e) when (e.StatusCode == HttpStatusCode.NotFound)
|
||||||
|
{
|
||||||
|
logger.LogDebug("Failed to fetch note, skipping: {error}", e.Message);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
logger.LogDebug("Failed to fetch note, skipping: {error}", e);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
if (fetchedNote == null)
|
if (fetchedNote == null)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue