From f8d4ec6ca6e56b15fcf8b71285588a82edd279d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Fri, 24 Sep 2021 19:58:10 -0400 Subject: [PATCH] fix: psql test --- src/socket.io/admin/cache.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/socket.io/admin/cache.js b/src/socket.io/admin/cache.js index 534cefeac8..9188ac8f5b 100644 --- a/src/socket.io/admin/cache.js +++ b/src/socket.io/admin/cache.js @@ -2,11 +2,13 @@ const SocketCache = module.exports; +const db = require('../../database'); + SocketCache.clear = async function (socket, data) { if (data.name === 'post') { require('../../posts/cache').reset(); - } else if (data.name === 'object') { - require('../../database').objectCache.reset(); + } else if (data.name === 'object' && db.objectCache) { + db.objectCache.reset(); } else if (data.name === 'group') { require('../../groups').cache.reset(); } else if (data.name === 'local') { @@ -17,7 +19,7 @@ SocketCache.clear = async function (socket, data) { SocketCache.toggle = async function (socket, data) { const caches = { post: require('../../posts/cache'), - object: require('../../database').objectCache, + object: db.objectCache, group: require('../../groups').cache, local: require('../../cache'), };