Spaces:
Running
Running
Download utils/lastActive.js from 4send/messenger: direct link, hf CLI and curl.
- Browser
- Download file 392 Bytes
-
https://huggingface.co/spaces/4send/messenger/resolve/main/utils/lastActive.js
- Command line
-
hf download hf://spaces/4send/messenger/utils/lastActive.js
-
curl -L -o lastActive.js https://huggingface.co/spaces/4send/messenger/resolve/main/utils/lastActive.js
392 Bytes
| const lastActiveCache = new Map(); | |
| const THROTTLE_MS = 5 * 60 * 1000; | |
| const shouldUpdateLastActive = (username, token) => { | |
| const key = `${username}:${token}`; | |
| const now = Date.now(); | |
| const last = lastActiveCache.get(key); | |
| if (last && now - last < THROTTLE_MS) return false; | |
| lastActiveCache.set(key, now); | |
| return true; | |
| }; | |
| module.exports = { shouldUpdateLastActive }; |