Skip to content

Node.js based forum software built for the modern web

fix: clearTimeout if item is evicted from cache

Barış Soner Uşaklı0997fbfa4db4
diff --git a/src/activitypub/index.js b/src/activitypub/index.js
index ef69d0bdf4..f4dd3cb5d2 100644
--- a/src/activitypub/index.js
+++ b/src/activitypub/index.js
@@ -348,7 +348,16 @@ ActivityPub.get = async (type, id, uri, options) => {
}
};
-ActivityPub.retryQueue = lru({ name: 'activitypub-retry-queue', max: 4000, ttl: 1000 * 60 * 60 * 24 * 60 });
+ActivityPub.retryQueue = lru({
+ name: 'activitypub-retry-queue',
+ max: 4000,
+ ttl: 1000 * 60 * 60 * 24 * 60,
+ dispose: (value) => {
+ if (value) {
+ clearTimeout(value);
+ }
+ },
+});
// handle clearing retry queue from another member of the cluster
pubsub.on(`activitypub-retry-queue:lruCache:del`, (keys) => {