aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNoah Loomans <noahloomans@gmail.com>2018-02-16 21:26:58 +0100
committerNoah Loomans <noahloomans@gmail.com>2018-02-16 21:26:58 +0100
commit63ed57a21099e72ad4662c85132cec647e1ee7c3 (patch)
treeb0bc0bb64cfd29fcd5e2ff698703a891b24fe4e4 /src
parentac0081a4bbb9426856443ca64d345fd964df6d2a (diff)
Increase cache to 30 minutes
Diffstat (limited to 'src')
-rw-r--r--src/server/lib/getMeetingpointData.js17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/server/lib/getMeetingpointData.js b/src/server/lib/getMeetingpointData.js
index c70b3fa..1687a6a 100644
--- a/src/server/lib/getMeetingpointData.js
+++ b/src/server/lib/getMeetingpointData.js
@@ -62,11 +62,11 @@ function requestData() {
return Promise.all(navbarRequests)
.then(([dailyScheduleResponse, basisScheduleResponse]) => {
- const dailySchedulePage = cheerio.load(dailyScheduleResponse.body);
- const basisSchedulePage = cheerio.load(basisScheduleResponse.body);
- const users = getUsers(dailySchedulePage);
- const dailyScheduleWeeks = getWeeks(dailySchedulePage);
- const basisScheduleWeeks = getWeeks(basisSchedulePage);
+ const dailySchedulePage = cheerio.load(dailyScheduleResponse.body);
+ const basisSchedulePage = cheerio.load(basisScheduleResponse.body);
+ const users = getUsers(dailySchedulePage);
+ const dailyScheduleWeeks = getWeeks(dailySchedulePage);
+ const basisScheduleWeeks = getWeeks(basisSchedulePage);
const teachers = users.filter(user => user.type === 't');
@@ -91,17 +91,18 @@ function requestData() {
basisScheduleWeeks,
};
- return meetingpointData;
- });
+ return meetingpointData;
+ });
});
}
function getMeetingpointData() {
- if (lastUpdate == null || new Date() - lastUpdate > 10 * 60 * 1000) { // 10 minutes
+ if (lastUpdate == null || new Date() - lastUpdate > 30 * 60 * 1000) { // 10 minutes
return requestData();
} else if (!meetingpointData) {
return Promise.reject();
}
+
return Promise.resolve(meetingpointData);
}