Throttle (once every 10sec) last seen app

This commit is contained in:
Daniel Lugo 2021-10-20 14:37:21 -04:00
parent 4b05bc014e
commit 694b6334c5

View file

@ -3,6 +3,7 @@
*/ */
const uuidv1 = require('uuid/v1') const uuidv1 = require('uuid/v1')
const logger = require('../../../config/log') const logger = require('../../../config/log')
const throttle = require('lodash/throttle')
const Common = require('shock-common') const Common = require('shock-common')
const { Constants, Schema } = Common const { Constants, Schema } = Common
@ -760,14 +761,14 @@ const saveChannelsBackup = async (backups, user, SEA) => {
/** /**
* @returns {Promise<void>} * @returns {Promise<void>}
*/ */
const setLastSeenApp = () => { const setLastSeenApp = throttle(() => {
const user = require('../Mediator').getUser() const user = require('../Mediator').getUser()
return user return user
.get(Key.PROFILE) .get(Key.PROFILE)
.get(Key.LAST_SEEN_APP) .get(Key.LAST_SEEN_APP)
.pPut(Date.now()) .pPut(Date.now())
} }, 10000)
/** /**
* @param {string[]} tags * @param {string[]} tags