From 694b6334c5e9b186513bec3c3e34b6d09ef738fe Mon Sep 17 00:00:00 2001 From: Daniel Lugo Date: Wed, 20 Oct 2021 14:37:21 -0400 Subject: [PATCH] Throttle (once every 10sec) last seen app --- services/gunDB/contact-api/actions.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/services/gunDB/contact-api/actions.js b/services/gunDB/contact-api/actions.js index 316360ee..2e8d1ca0 100644 --- a/services/gunDB/contact-api/actions.js +++ b/services/gunDB/contact-api/actions.js @@ -3,6 +3,7 @@ */ const uuidv1 = require('uuid/v1') const logger = require('../../../config/log') +const throttle = require('lodash/throttle') const Common = require('shock-common') const { Constants, Schema } = Common @@ -760,14 +761,14 @@ const saveChannelsBackup = async (backups, user, SEA) => { /** * @returns {Promise} */ -const setLastSeenApp = () => { +const setLastSeenApp = throttle(() => { const user = require('../Mediator').getUser() return user .get(Key.PROFILE) .get(Key.LAST_SEEN_APP) .pPut(Date.now()) -} +}, 10000) /** * @param {string[]} tags