Skip to content

Commit

Permalink
Merge pull request #107 from Lukasdotcom/spam-refresh
Browse files Browse the repository at this point in the history
Fixes bug with spam refreshes when start time is unknown
  • Loading branch information
Lukasdotcom authored Aug 12, 2022
2 parents 9be917e + f485d6b commit c127c8a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bundesliga",
"version": "1.4.0",
"version": "1.4.1",
"private": true,
"scripts": {
"dev": "export NODE_ENV=development; npm install; node scripts/entrypoint.mjs & next dev",
Expand Down
16 changes: 11 additions & 5 deletions scripts/entrypoint.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -252,9 +252,12 @@ async function update() {
time - 10,
]);
} else {
console.log(`Predicting start of matchday in ${time} seconds`);
// Makes sure to wait until the time is done
setTimeout(updateData, time * 1000 + 1);
// Makes sure that the amount of time left in the transfer is not unknown
if (time !== 0) {
console.log(`Predicting start of matchday in ${time} seconds`);
// Makes sure to wait until the time is done
setTimeout(updateData, time * 1000 + 1);
}
}
} else {
if (time - 11 > 0) {
Expand All @@ -266,8 +269,11 @@ async function update() {
time - 10,
]);
} else {
console.log(`Predicting end of matchday in ${time} seconds`);
setTimeout(updateData, time * 1000 + 1);
// Makes sure that the amount of time left in the matchday is not unknown
if (time !== 0) {
console.log(`Predicting end of matchday in ${time} seconds`);
setTimeout(updateData, time * 1000 + 1);
}
}
}
}
Expand Down

0 comments on commit c127c8a

Please sign in to comment.