Do not recreate interval on hot-reloads

This commit is contained in:
Rogerio Chaves 2020-04-26 19:08:41 +02:00
parent ddd5bff147
commit e6ce416dce
No known key found for this signature in database
GPG Key ID: E6AF5440509B1D94
1 changed files with 6 additions and 4 deletions

View File

@ -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,