summaryrefslogtreecommitdiff
path: root/packages/backend/src/queue
diff options
context:
space:
mode:
authormisskey-release-bot[bot] <157398866+misskey-release-bot[bot]@users.noreply.github.com>2025-01-28 12:29:14 +0000
committerGitHub <noreply@github.com>2025-01-28 12:29:14 +0000
commit36880493cb16e87feb83484498fcd3cc871eb68d (patch)
tree277127cf0e6c6990577935c5bb5dff9269c605b0 /packages/backend/src/queue
parentMerge pull request #14924 from misskey-dev/develop (diff)
parentRelease: 2025.1.0 (diff)
downloadmisskey-36880493cb16e87feb83484498fcd3cc871eb68d.tar.gz
misskey-36880493cb16e87feb83484498fcd3cc871eb68d.tar.bz2
misskey-36880493cb16e87feb83484498fcd3cc871eb68d.zip
Merge pull request #15279 from misskey-dev/develop
Release: 2025.1.0
Diffstat (limited to 'packages/backend/src/queue')
-rw-r--r--packages/backend/src/queue/processors/CheckModeratorsActivityProcessorService.ts26
-rw-r--r--packages/backend/src/queue/processors/CleanChartsProcessorService.ts27
-rw-r--r--packages/backend/src/queue/processors/ImportCustomEmojisProcessorService.ts5
-rw-r--r--packages/backend/src/queue/processors/ResyncChartsProcessorService.ts9
-rw-r--r--packages/backend/src/queue/processors/TickChartsProcessorService.ts27
-rw-r--r--packages/backend/src/queue/types.ts17
6 files changed, 52 insertions, 59 deletions
diff --git a/packages/backend/src/queue/processors/CheckModeratorsActivityProcessorService.ts b/packages/backend/src/queue/processors/CheckModeratorsActivityProcessorService.ts
index 87183cb342..2e84430e72 100644
--- a/packages/backend/src/queue/processors/CheckModeratorsActivityProcessorService.ts
+++ b/packages/backend/src/queue/processors/CheckModeratorsActivityProcessorService.ts
@@ -231,15 +231,10 @@ export class CheckModeratorsActivityProcessorService {
// -- SystemWebhook
- const systemWebhooks = await this.systemWebhookService.fetchActiveSystemWebhooks()
- .then(it => it.filter(it => it.on.includes('inactiveModeratorsWarning')));
- for (const systemWebhook of systemWebhooks) {
- this.systemWebhookService.enqueueSystemWebhook(
- systemWebhook,
- 'inactiveModeratorsWarning',
- { remainingTime: remainingTime },
- );
- }
+ return this.systemWebhookService.enqueueSystemWebhook(
+ 'inactiveModeratorsWarning',
+ { remainingTime: remainingTime },
+ );
}
@bindThis
@@ -269,15 +264,10 @@ export class CheckModeratorsActivityProcessorService {
// -- SystemWebhook
- const systemWebhooks = await this.systemWebhookService.fetchActiveSystemWebhooks()
- .then(it => it.filter(it => it.on.includes('inactiveModeratorsInvitationOnlyChanged')));
- for (const systemWebhook of systemWebhooks) {
- this.systemWebhookService.enqueueSystemWebhook(
- systemWebhook,
- 'inactiveModeratorsInvitationOnlyChanged',
- {},
- );
- }
+ return this.systemWebhookService.enqueueSystemWebhook(
+ 'inactiveModeratorsInvitationOnlyChanged',
+ {},
+ );
}
@bindThis
diff --git a/packages/backend/src/queue/processors/CleanChartsProcessorService.ts b/packages/backend/src/queue/processors/CleanChartsProcessorService.ts
index 110468801c..8c5faa8d07 100644
--- a/packages/backend/src/queue/processors/CleanChartsProcessorService.ts
+++ b/packages/backend/src/queue/processors/CleanChartsProcessorService.ts
@@ -48,20 +48,19 @@ export class CleanChartsProcessorService {
public async process(): Promise<void> {
this.logger.info('Clean charts...');
- await Promise.all([
- this.federationChart.clean(),
- this.notesChart.clean(),
- this.usersChart.clean(),
- this.activeUsersChart.clean(),
- this.instanceChart.clean(),
- this.perUserNotesChart.clean(),
- this.perUserPvChart.clean(),
- this.driveChart.clean(),
- this.perUserReactionsChart.clean(),
- this.perUserFollowingChart.clean(),
- this.perUserDriveChart.clean(),
- this.apRequestChart.clean(),
- ]);
+ // DBへの同時接続を避けるためにPromise.allを使わずひとつずつ実行する
+ await this.federationChart.clean();
+ await this.notesChart.clean();
+ await this.usersChart.clean();
+ await this.activeUsersChart.clean();
+ await this.instanceChart.clean();
+ await this.perUserNotesChart.clean();
+ await this.perUserPvChart.clean();
+ await this.driveChart.clean();
+ await this.perUserReactionsChart.clean();
+ await this.perUserFollowingChart.clean();
+ await this.perUserDriveChart.clean();
+ await this.apRequestChart.clean();
this.logger.succ('All charts successfully cleaned.');
}
diff --git a/packages/backend/src/queue/processors/ImportCustomEmojisProcessorService.ts b/packages/backend/src/queue/processors/ImportCustomEmojisProcessorService.ts
index 9e1b8fee70..725e1c8ba2 100644
--- a/packages/backend/src/queue/processors/ImportCustomEmojisProcessorService.ts
+++ b/packages/backend/src/queue/processors/ImportCustomEmojisProcessorService.ts
@@ -87,6 +87,7 @@ export class ImportCustomEmojisProcessorService {
await this.emojisRepository.delete({
name: emojiInfo.name,
});
+
try {
const driveFile = await this.driveService.addFile({
user: null,
@@ -95,11 +96,13 @@ export class ImportCustomEmojisProcessorService {
force: true,
});
await this.customEmojiService.add({
+ originalUrl: driveFile.url,
+ publicUrl: driveFile.webpublicUrl ?? driveFile.url,
+ fileType: driveFile.webpublicType ?? driveFile.type,
name: emojiInfo.name,
category: emojiInfo.category,
host: null,
aliases: emojiInfo.aliases,
- driveFile,
license: emojiInfo.license,
isSensitive: emojiInfo.isSensitive,
localOnly: emojiInfo.localOnly,
diff --git a/packages/backend/src/queue/processors/ResyncChartsProcessorService.ts b/packages/backend/src/queue/processors/ResyncChartsProcessorService.ts
index 570cdf9a75..0c47fdedb3 100644
--- a/packages/backend/src/queue/processors/ResyncChartsProcessorService.ts
+++ b/packages/backend/src/queue/processors/ResyncChartsProcessorService.ts
@@ -29,13 +29,12 @@ export class ResyncChartsProcessorService {
public async process(): Promise<void> {
this.logger.info('Resync charts...');
+ // DBへの同時接続を避けるためにPromise.allを使わずひとつずつ実行する
// TODO: ユーザーごとのチャートも更新する
// TODO: インスタンスごとのチャートも更新する
- await Promise.all([
- this.driveChart.resync(),
- this.notesChart.resync(),
- this.usersChart.resync(),
- ]);
+ await this.driveChart.resync();
+ await this.notesChart.resync();
+ await this.usersChart.resync();
this.logger.succ('All charts successfully resynced.');
}
diff --git a/packages/backend/src/queue/processors/TickChartsProcessorService.ts b/packages/backend/src/queue/processors/TickChartsProcessorService.ts
index 93ec34162d..fc8856a271 100644
--- a/packages/backend/src/queue/processors/TickChartsProcessorService.ts
+++ b/packages/backend/src/queue/processors/TickChartsProcessorService.ts
@@ -48,20 +48,19 @@ export class TickChartsProcessorService {
public async process(): Promise<void> {
this.logger.info('Tick charts...');
- await Promise.all([
- this.federationChart.tick(false),
- this.notesChart.tick(false),
- this.usersChart.tick(false),
- this.activeUsersChart.tick(false),
- this.instanceChart.tick(false),
- this.perUserNotesChart.tick(false),
- this.perUserPvChart.tick(false),
- this.driveChart.tick(false),
- this.perUserReactionsChart.tick(false),
- this.perUserFollowingChart.tick(false),
- this.perUserDriveChart.tick(false),
- this.apRequestChart.tick(false),
- ]);
+ // DBへの同時接続を避けるためにPromise.allを使わずひとつずつ実行する
+ await this.federationChart.tick(false);
+ await this.notesChart.tick(false);
+ await this.usersChart.tick(false);
+ await this.activeUsersChart.tick(false);
+ await this.instanceChart.tick(false);
+ await this.perUserNotesChart.tick(false);
+ await this.perUserPvChart.tick(false);
+ await this.driveChart.tick(false);
+ await this.perUserReactionsChart.tick(false);
+ await this.perUserFollowingChart.tick(false);
+ await this.perUserDriveChart.tick(false);
+ await this.apRequestChart.tick(false);
this.logger.succ('All charts successfully ticked.');
}
diff --git a/packages/backend/src/queue/types.ts b/packages/backend/src/queue/types.ts
index a4077a0547..5db919a149 100644
--- a/packages/backend/src/queue/types.ts
+++ b/packages/backend/src/queue/types.ts
@@ -6,9 +6,12 @@
import type { Antenna } from '@/server/api/endpoints/i/import-antennas.js';
import type { MiDriveFile } from '@/models/DriveFile.js';
import type { MiNote } from '@/models/Note.js';
+import type { SystemWebhookEventType } from '@/models/SystemWebhook.js';
import type { MiUser } from '@/models/User.js';
-import type { MiWebhook } from '@/models/Webhook.js';
+import type { MiWebhook, WebhookEventTypes } from '@/models/Webhook.js';
import type { IActivity } from '@/core/activitypub/type.js';
+import type { SystemWebhookPayload } from '@/core/SystemWebhookService.js';
+import type { UserWebhookPayload } from '@/core/UserWebhookService.js';
import type httpSignature from '@peertube/http-signature';
export type DeliverJobData = {
@@ -106,9 +109,9 @@ export type EndedPollNotificationJobData = {
noteId: MiNote['id'];
};
-export type SystemWebhookDeliverJobData = {
- type: string;
- content: unknown;
+export type SystemWebhookDeliverJobData<T extends SystemWebhookEventType = SystemWebhookEventType> = {
+ type: T;
+ content: SystemWebhookPayload<T>;
webhookId: MiWebhook['id'];
to: string;
secret: string;
@@ -116,9 +119,9 @@ export type SystemWebhookDeliverJobData = {
eventId: string;
};
-export type UserWebhookDeliverJobData = {
- type: string;
- content: unknown;
+export type UserWebhookDeliverJobData<T extends WebhookEventTypes = WebhookEventTypes> = {
+ type: T;
+ content: UserWebhookPayload<T>;
webhookId: MiWebhook['id'];
userId: MiUser['id'];
to: string;