Merge branch 'develop' into feature/2024.10

This commit is contained in:
dakkar 2024-11-23 10:41:33 +00:00
commit 6c13dc04f2
26 changed files with 849 additions and 366 deletions

View file

@ -11,6 +11,7 @@ import { DI } from '@/di-symbols.js';
import type Logger from '@/logger.js';
import { bindThis } from '@/decorators.js';
import { CheckModeratorsActivityProcessorService } from '@/queue/processors/CheckModeratorsActivityProcessorService.js';
import { StatusError } from '@/misc/status-error.js';
import { UserWebhookDeliverProcessorService } from './processors/UserWebhookDeliverProcessorService.js';
import { SystemWebhookDeliverProcessorService } from './processors/SystemWebhookDeliverProcessorService.js';
import { EndedPollNotificationProcessorService } from './processors/EndedPollNotificationProcessorService.js';
@ -134,7 +135,7 @@ export class QueueProcessorService implements OnApplicationShutdown {
// 何故かeがundefinedで来ることがある
if (!e) return '?';
if (e instanceof Bull.UnrecoverableError || e.name === 'AbortError') {
if (e instanceof Bull.UnrecoverableError || e.name === 'AbortError' || e instanceof StatusError) {
return `${e.name}: ${e.message}`;
}
@ -148,12 +149,15 @@ export class QueueProcessorService implements OnApplicationShutdown {
function renderJob(job?: Bull.Job) {
if (!job) return '?';
return {
name: job.name || undefined,
const info: Record<string, string> = {
info: getJobInfo(job),
failedReason: job.failedReason || undefined,
data: job.data,
};
if (job.name) info.name = job.name;
if (job.failedReason) info.failedReason = job.failedReason;
return info;
}
//#region system

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';
@ -238,6 +239,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';