Skip to content

Node.js based forum software built for the modern web

feat: allow activitypub request cache to be ignored

Julian Lam485b7758372f
diff --git a/src/activitypub/actors.js b/src/activitypub/actors.js
index 353e093571..711c9d6739 100644
--- a/src/activitypub/actors.js
+++ b/src/activitypub/actors.js
@@ -86,7 +86,7 @@ Actors.assert = async (ids, options = {}) => {
let actors = await Promise.all(ids.map(async (id) => {
try {
// winston.verbose(`[activitypub/actors] Processing ${id}`);
- const actor = (typeof id === 'object' && id.hasOwnProperty('id')) ? id : await activitypub.get('uid', 0, id);
+ const actor = (typeof id === 'object' && id.hasOwnProperty('id')) ? id : await activitypub.get('uid', 0, id, { cache: false });
// Follow counts
try {
diff --git a/src/activitypub/index.js b/src/activitypub/index.js
index 5cfb5cf308..8854e26edf 100644
--- a/src/activitypub/index.js
+++ b/src/activitypub/index.js
@@ -251,10 +251,14 @@ ActivityPub.verify = async (req) => {
}
};
-ActivityPub.get = async (type, id, uri) => {
+ActivityPub.get = async (type, id, uri, options) => {
+ options = {
+ cache: true,
+ ...options,
+ };
const cacheKey = [id, uri].join(';');
const cached = requestCache.get(cacheKey);
- if (cached !== undefined) {
+ if (options.cache && cached !== undefined) {
return cached;
}