mirror of
https://activitypub.software/TransFem-org/Sharkey.git
synced 2024-12-29 18:09:05 +01:00
reduce inbox log spam when fetching blocked / unavailable notes
This commit is contained in:
parent
47eb0daebb
commit
2bbccde2ce
2 changed files with 22 additions and 4 deletions
|
@ -10,6 +10,7 @@ import type { Config } from '@/config.js';
|
||||||
import { DI } from '@/di-symbols.js';
|
import { DI } from '@/di-symbols.js';
|
||||||
import type Logger from '@/logger.js';
|
import type Logger from '@/logger.js';
|
||||||
import { bindThis } from '@/decorators.js';
|
import { bindThis } from '@/decorators.js';
|
||||||
|
import { StatusError } from '@/misc/status-error.js';
|
||||||
import { UserWebhookDeliverProcessorService } from './processors/UserWebhookDeliverProcessorService.js';
|
import { UserWebhookDeliverProcessorService } from './processors/UserWebhookDeliverProcessorService.js';
|
||||||
import { SystemWebhookDeliverProcessorService } from './processors/SystemWebhookDeliverProcessorService.js';
|
import { SystemWebhookDeliverProcessorService } from './processors/SystemWebhookDeliverProcessorService.js';
|
||||||
import { EndedPollNotificationProcessorService } from './processors/EndedPollNotificationProcessorService.js';
|
import { EndedPollNotificationProcessorService } from './processors/EndedPollNotificationProcessorService.js';
|
||||||
|
@ -132,7 +133,7 @@ export class QueueProcessorService implements OnApplicationShutdown {
|
||||||
// 何故かeがundefinedで来ることがある
|
// 何故かeがundefinedで来ることがある
|
||||||
if (!e) return '?';
|
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}`;
|
return `${e.name}: ${e.message}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -146,12 +147,15 @@ export class QueueProcessorService implements OnApplicationShutdown {
|
||||||
function renderJob(job?: Bull.Job) {
|
function renderJob(job?: Bull.Job) {
|
||||||
if (!job) return '?';
|
if (!job) return '?';
|
||||||
|
|
||||||
return {
|
const info: Record<string, string> = {
|
||||||
name: job.name || undefined,
|
|
||||||
info: getJobInfo(job),
|
info: getJobInfo(job),
|
||||||
failedReason: job.failedReason || undefined,
|
|
||||||
data: job.data,
|
data: job.data,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (job.name) info.name = job.name;
|
||||||
|
if (job.failedReason) info.failedReason = job.failedReason;
|
||||||
|
|
||||||
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
//#region system
|
//#region system
|
||||||
|
|
|
@ -7,6 +7,7 @@ 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';
|
||||||
|
@ -232,6 +233,19 @@ export class InboxProcessorService implements OnApplicationShutdown {
|
||||||
return e.message;
|
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;
|
throw e;
|
||||||
}
|
}
|
||||||
return 'ok';
|
return 'ok';
|
||||||
|
|
Loading…
Reference in a new issue