Skip to content

Node.js based forum software built for the modern web

feat(activitypub): log send pool failures via analytics.sendError

Julian Lam94b1ad5dc143
diff --git a/src/activitypub/send.js b/src/activitypub/send.js
index 364f58f20f..050c6af190 100644
--- a/src/activitypub/send.js
+++ b/src/activitypub/send.js
@@ -149,9 +149,15 @@ SendPool.handleResult = function (message) {
db.sortedSetRemove('ap:retry:queue', task.queueId);
SendPool.inFlight.delete(task.queueId);
} else {
- // Failure — re-queue with backoff
- winston.warn(`[activitypub/send] Task ${id} failed: ${error}`);
- // No longer in-flight — allow the re-queued task to be picked up again
+ try {
+ SendPool._activityPub.analytics.sendError({
+ payload: JSON.parse(task.payload),
+ uri: task.uri,
+ error: new Error(error),
+ });
+ } catch (e) {
+ winston.warn(`[activitypub/send] Task ${id} failed: ${error}`);
+ }
SendPool.inFlight.delete(task.queueId);
SendPool.requeueTask(task);
}