diff options
| author | Marie <marie@kaifa.ch> | 2024-01-09 02:57:57 +0100 |
|---|---|---|
| committer | Marie <marie@kaifa.ch> | 2024-01-09 02:57:57 +0100 |
| commit | 7552cea69ae21b31799d54b246dcd45e96654926 (patch) | |
| tree | 389031f25fee72180157869a9e60c31704e198a9 /packages/backend/src/core/QueueService.ts | |
| parent | merge: additional authorised fetch logging (#328) (diff) | |
| parent | feat(ci): api.jsonのバリデーションチェックCIを追加 (#12950) (diff) | |
| download | sharkey-7552cea69ae21b31799d54b246dcd45e96654926.tar.gz sharkey-7552cea69ae21b31799d54b246dcd45e96654926.tar.bz2 sharkey-7552cea69ae21b31799d54b246dcd45e96654926.zip | |
merge: upstream
Diffstat (limited to 'packages/backend/src/core/QueueService.ts')
| -rw-r--r-- | packages/backend/src/core/QueueService.ts | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/packages/backend/src/core/QueueService.ts b/packages/backend/src/core/QueueService.ts index 2ee61eb549..e1c84535a0 100644 --- a/packages/backend/src/core/QueueService.ts +++ b/packages/backend/src/core/QueueService.ts @@ -17,6 +17,7 @@ import type { DbJobData, DeliverJobData, RelationshipJobData, ThinUser } from '. import type httpSignature from '@peertube/http-signature'; import type * as Bull from 'bullmq'; import { MiNote } from '@/models/Note.js'; +import { ApRequestCreator } from '@/core/activitypub/ApRequestService.js'; @Injectable() export class QueueService { @@ -75,11 +76,15 @@ export class QueueService { if (content == null) return null; if (to == null) return null; + const contentBody = JSON.stringify(content); + const digest = ApRequestCreator.createDigest(contentBody); + const data: DeliverJobData = { user: { id: user.id, }, - content, + content: contentBody, + digest, to, isSharedInbox, }; @@ -104,6 +109,8 @@ export class QueueService { @bindThis public async deliverMany(user: ThinUser, content: IActivity | null, inboxes: Map<string, boolean>) { if (content == null) return null; + const contentBody = JSON.stringify(content); + const digest = ApRequestCreator.createDigest(contentBody); const opts = { attempts: this.config.deliverJobMaxAttempts ?? 12, @@ -118,7 +125,8 @@ export class QueueService { name: d[0], data: { user, - content, + content: contentBody, + digest, to: d[0], isSharedInbox: d[1], } as DeliverJobData, @@ -186,6 +194,16 @@ export class QueueService { } @bindThis + public createExportClipsJob(user: ThinUser) { + return this.dbQueue.add('exportClips', { + user: { id: user.id }, + }, { + removeOnComplete: true, + removeOnFail: true, + }); + } + + @bindThis public createExportFavoritesJob(user: ThinUser) { return this.dbQueue.add('exportFavorites', { user: { id: user.id }, |