rethrow everything but non-retryable HTTP errors

every job that ends without an exception will be considered
"completed" and not retried
This commit is contained in:
dakkar 2024-12-21 16:57:06 +00:00 committed by Hazelnoot
parent 5eca807e19
commit e4047b4076

View file

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