Skip to content

Commit

Permalink
Merge pull request #140 from redet-G/master
Browse files Browse the repository at this point in the history
Caching API call for 4 hours
  • Loading branch information
SaptarshiSarkar12 authored Oct 22, 2022
2 parents 9c0b23b + c48e4be commit 4b1140b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Website/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,10 @@ function generateDiv(x) {
// Release SECTION ----
let releases = localStorage.getItem("releases");
let releasesRequestedAt = localStorage.getItem("releasesRequestedAt");
if (parseInt(releasesRequestedAt) > 23) localStorage.removeItem("requestedAt"); // fetch release information every day
if (parseInt(releasesRequestedAt) > 23) localStorage.removeItem("requestedAt");
if (releases == null || releasesRequestedAt == null) getReleases();
else if (currentHour != releasesRequestedAt) getReleases();
else if (currentHour - releasesRequestedAt >= 4)
getReleases(); // get release info every 4 hours
else updateReleases();

function getReleases() {
Expand Down

0 comments on commit 4b1140b

Please sign in to comment.