mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-03 04:25:55 +01:00
feat: allow activitypub request cache to be ignored
This commit is contained in:
@@ -86,7 +86,7 @@ Actors.assert = async (ids, options = {}) => {
|
|||||||
let actors = await Promise.all(ids.map(async (id) => {
|
let actors = await Promise.all(ids.map(async (id) => {
|
||||||
try {
|
try {
|
||||||
// winston.verbose(`[activitypub/actors] Processing ${id}`);
|
// 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
|
// Follow counts
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -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 cacheKey = [id, uri].join(';');
|
||||||
const cached = requestCache.get(cacheKey);
|
const cached = requestCache.get(cacheKey);
|
||||||
if (cached !== undefined) {
|
if (options.cache && cached !== undefined) {
|
||||||
return cached;
|
return cached;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user