From a325bb554a51e398ae84c02a68dd21bbbad44660 Mon Sep 17 00:00:00 2001 From: Dave Horton Date: Fri, 19 Aug 2022 09:38:40 +0200 Subject: [PATCH] bugfix #152: add key to fsUUIDs periodically --- lib/utils/sbc-pinger.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/utils/sbc-pinger.js b/lib/utils/sbc-pinger.js index 7d147fb8..892796c7 100644 --- a/lib/utils/sbc-pinger.js +++ b/lib/utils/sbc-pinger.js @@ -104,8 +104,14 @@ module.exports = (logger) => { const {srf} = require('../..'); const {addToSet} = srf.locals.dbHelpers; const uuid = srf.locals.fsUUID = uuidv4(); - addToSet(FS_UUID_SET_NAME, uuid) - .catch((err) => logger.info({err}, `Error adding ${uuid} to set ${FS_UUID_SET_NAME}`)); + + /* in case redis is restarted, re-insert our key every so often */ + setInterval(() => { + // eslint-disable-next-line max-len + addToSet(FS_UUID_SET_NAME, uuid).catch((err) => logger.info({err}, `Error adding ${uuid} to set ${FS_UUID_SET_NAME}`)); + }, 30000); + // eslint-disable-next-line max-len + addToSet(FS_UUID_SET_NAME, uuid).catch((err) => logger.info({err}, `Error adding ${uuid} to set ${FS_UUID_SET_NAME}`)); }); } else {