Merge pull request #14 from Maathias/misc

fix: stale value
This commit was merged in pull request #14.
This commit is contained in:
Mateusz Pstrucha authored and GitHub committed 2021-11-03 23:49:18 +01:00
commit aa2fe803da
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) => {