Skip to content

Node.js based forum software built for the modern web

fix: use batch.processArray properly

Opliko729f0fcac1df
diff --git a/src/activitypub/index.js b/src/activitypub/index.js
index 5c5fbb60b8..e6bfc2c7a5 100644
--- a/src/activitypub/index.js
+++ b/src/activitypub/index.js
@@ -284,6 +284,8 @@ async function sendMessage(uri, id, type, payload, attempts = 1) {
ActivityPub.retryQueue.set(queueId, timeoutId);
winston.verbose(`[activitypub/send] Added ${payload.type} to ${uri} to retry queue for ${timeout}ms`);
+ } else {
+ winston.warn(`[activitypub/send] Max attempts reached for ${payload.type} to ${uri}; giving up on sending`);
}
}
}
@@ -305,6 +307,10 @@ ActivityPub.send = async (type, id, targets, payload) => {
await batch.processArray(
inboxes,
- async inboxBatch => Promise.all(inboxBatch.map(async uri => sendMessage(uri, id, type, payload)))
+ async inboxBatch => Promise.all(inboxBatch.map(async uri => sendMessage(uri, id, type, payload))),
+ {
+ batch: 50,
+ interval: 100,
+ },
);
};