Skip to content

Commit

Permalink
Merge pull request #208 from teknologi-umum/fix-hackernews
Browse files Browse the repository at this point in the history
Fix sleep time calculation in hackernews.js
  • Loading branch information
ronnygunawan authored Nov 17, 2023
2 parents b4a05ca + 1069999 commit 40f45bb
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/hackernews.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ for (;;) {

while (!done) {
// wait
await sleep(1000);

Check warning on line 30 in src/hackernews.js

View workflow job for this annotation

GitHub Actions / CI

Unexpected `await` inside a loop
}
}

Expand All @@ -36,8 +37,8 @@ for (;;) {

if (now.getUTCHours() >= 11) {
// The next time is 00:00 AM
nextTime = new Date(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDay() + 1, 0, 0, 0, 0);
} else if (now.getHours() < 11) {
nextTime = new Date(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDay() + 1, 11, 0, 0, 0);
} else if (now.getUTCHours() < 11) {
// The next time is 11:00 AM
nextTime = new Date(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDay(), 11, 0, 0, 0);
}
Expand Down

0 comments on commit 40f45bb

Please sign in to comment.