summaryrefslogtreecommitdiff
path: root/api.js
diff options
context:
space:
mode:
Diffstat (limited to 'api.js')
-rw-r--r--api.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/api.js b/api.js
index 6cdc0b4..e36a774 100644
--- a/api.js
+++ b/api.js
@@ -117,6 +117,14 @@ app.get("/api/player/:name", async (req, res) => {
grab_start = new Date("2017-01-01T00:00:00Z");
}
+ var timedelta_minutes = ((new Date()) - grab_start) / 1000 / 60;
+ // TODO make it configurable
+ if (timedelta_minutes < 30) {
+ console.log("player '" + name + "' update skipped");
+ res.sendStatus(304);
+ return;
+ }
+
/* request update job */
// createdAt-start <= x <= createdAt-end
grab_start.setSeconds(grab_start.getSeconds() + 1);