activitypub: allow to group elements for delivery

This commit is contained in:
Johann150 2023-03-11 01:05:31 +01:00
parent 78c93c5539
commit 1bce487965
Signed by untrusted user: Johann150
GPG key ID: 9EE6577A2A06F8F1

View file

@ -19,8 +19,13 @@ export default async (job: Bull.Job<DeliverJobData>) => {
if (await shouldSkipInstance(puny)) return 'skip'; if (await shouldSkipInstance(puny)) return 'skip';
try { try {
if (Array.isArray(job.data.content)) {
await request(job.data.user, job.data.to, job.data.content); await Promise.all(
job.data.content.map(x => request(job.data.user, job.data.to, x))
);
} else {
await request(job.data.user, job.data.to, job.data.content);
}
// Update stats // Update stats
registerOrFetchInstanceDoc(host).then(i => { registerOrFetchInstanceDoc(host).then(i => {