fix: stale value

This commit is contained in:
Mateusz Pstrucha committed 2021-11-03 23:48:06 +01:00
1 parent 4680aaeba6
commit 1bc3fb8008
1 file changed
+3 -2
+3 -2
View File
@@ -65,7 +65,8 @@ function broadcast(cats) {
export { getTrackRank, parseTop }
const maxPrevious = 20,
staleTop = 3e3
staleTop = 60e3,
staleAfterVotes = 2
var topList = await countAllVotes().then((results) => parseTop(results)),
lastTop = -1,
@@ -195,7 +196,7 @@ const db = {
let now = new Date().getTime()
// update if stale
if (now - lastTop > staleTop || votesSince >= 2) {
if (now - lastTop > staleTop || votesSince >= staleAfterVotes) {
countAllVotes()
.then((results) => parseTop(results))
.then((top) => {