reduce inbox log spam when fetching blocked / unavailable notes

This commit is contained in:
Hazelnoot 2024-11-03 17:59:33 -05:00
parent 47eb0daebb
commit 2bbccde2ce
2 changed files with 22 additions and 4 deletions

View file

@ -7,6 +7,7 @@ import { URL } from 'node:url';
import { Inject, Injectable, OnApplicationShutdown } from '@nestjs/common';
import httpSignature from '@peertube/http-signature';
import * as Bull from 'bullmq';
import { AbortError } from 'node-fetch';
import type Logger from '@/logger.js';
import { FederatedInstanceService } from '@/core/FederatedInstanceService.js';
import { FetchInstanceMetadataService } from '@/core/FetchInstanceMetadataService.js';
@ -232,6 +233,19 @@ export class InboxProcessorService implements OnApplicationShutdown {
return e.message;
}
}
if (e instanceof StatusError) {
if (e.isRetryable) {
return `temporary error ${e.statusCode}`;
} else {
return `skip: permanent error ${e.statusCode}`;
}
}
if (e instanceof AbortError) {
return 'request aborted';
}
throw e;
}
return 'ok';