From e6ce416dcef4cf08d0e680d1822bf59db8190446 Mon Sep 17 00:00:00 2001 From: Rogerio Chaves Date: Sun, 26 Apr 2020 19:08:41 +0200 Subject: [PATCH] Do not recreate interval on hot-reloads --- app/lib/queries.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/lib/queries.js b/app/lib/queries.js index 1eb9147..d73962f 100644 --- a/app/lib/queries.js +++ b/app/lib/queries.js @@ -668,10 +668,12 @@ const getCommunityPosts = async (name) => { return Object.values(communityPostsByKey); }; -setInterval(() => { - debugProfile("Clearing profile cache"); - profileCache = {}; -}, 5 * 60 * 1000); +if (!global.clearProfileInterval) { + global.clearProfileInterval = setInterval(() => { + debugProfile("Clearing profile cache"); + profileCache = {}; + }, 5 * 60 * 1000); +} module.exports = { mapProfiles,