Skip to content

Commit

Permalink
Added Unirest Timeouts
Browse files Browse the repository at this point in the history
* For API and API-Legacy
* Updated Status messages
* Version 0.13.19
  • Loading branch information
aneesh-neelam committed Feb 13, 2015
1 parent 079a247 commit 9cd7270
Show file tree
Hide file tree
Showing 15 changed files with 17 additions and 5 deletions.
1 change: 1 addition & 0 deletions api-legacy/login/get.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,6 @@ exports.get = function (app, data, callback) {
};
unirest.get(captchaUri)
.encoding(null)
.timeout(29000)
.end(onRequest);
};
1 change: 1 addition & 0 deletions api-legacy/login/submit.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ exports.get = function (app, data, callback) {
'wdpswd': data.dob,
'vrfcd': data.captcha
})
.timeout(29000)
.end(onPost);
}
else {
Expand Down
2 changes: 2 additions & 0 deletions api-legacy/scraper/attendance.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ exports.scrapeAttendance = function (app, data, callback) {
unirest.post(attendanceDetailsUri)
.jar(CookieJar)
.form(doc.form)
.timeout(28500)
.end(onPost);
};
async.map(attendance, doDetails, callback);
Expand All @@ -129,5 +130,6 @@ exports.scrapeAttendance = function (app, data, callback) {
CookieJar.add(unirest.cookie(cookieSerial), attendanceDetailsUri);
unirest.post(attendanceUri)
.jar(CookieJar)
.timeout(29000)
.end(onRequest);
};
1 change: 1 addition & 0 deletions api-legacy/scraper/marks.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,5 +191,6 @@ exports.scrapeMarks = function (app, data, callback) {
CookieJar.add(unirest.cookie(cookieSerial), marksUri);
unirest.post(marksUri)
.jar(CookieJar)
.timeout(29000)
.end(onRequest);
};
1 change: 1 addition & 0 deletions api-legacy/scraper/timetable.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,5 +183,6 @@ exports.scrapeTimetable = function (app, data, callback) {
CookieJar.add(unirest.cookie(cookieSerial), timetableUri);
unirest.post(timetableUri)
.jar(CookieJar)
.timeout(29000)
.end(onRequest);
};
2 changes: 1 addition & 1 deletion api-legacy/status.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ var error = {
tokenExpired: {message: 'Token expired', code: 14},
noData: {message: 'Requested data is not available', code: 15},
toDo: {message: 'This feature is incomplete', code: 50},
vitDown: {message: 'VIT\'s servers may be down or we may be facing a connectivity issue', code: 89},
vitDown: {message: 'VIT\'s servers may be slowed down or we may be facing a connectivity issue', code: 89},
mongoDown: {message: 'Our MongoDB instance may be down or we may be facing a connectivity issue', code: 97},
outage: {message: 'Our backend servers may be down or you may be facing a connectivity issue', code: 98},
other: {message: 'An unforeseen error has occurred', code: 99}
Expand Down
1 change: 1 addition & 0 deletions api/login/get.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,6 @@ exports.get = function (app, data, callback) {
};
unirest.get(captchaUri)
.encoding(null)
.timeout(29000)
.end(onRequest);
};
1 change: 1 addition & 0 deletions api/login/submit.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ exports.get = function (app, data, callback) {
'wdpswd': data.dob,
'vrfcd': data.captcha
})
.timeout(29000)
.end(onPost);
}
else {
Expand Down
2 changes: 2 additions & 0 deletions api/scraper/attendance.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ exports.scrapeAttendance = function (app, data, callback) {
unirest.post(attendanceDetailsUri)
.jar(CookieJar)
.form(doc.form)
.timeout(28500)
.end(onPost);
};
async.map(attendance, doDetails, callback);
Expand All @@ -139,5 +140,6 @@ exports.scrapeAttendance = function (app, data, callback) {
CookieJar.add(unirest.cookie(cookieSerial), attendanceDetailsUri);
unirest.post(attendanceUri)
.jar(CookieJar)
.timeout(29000)
.end(onRequest);
};
1 change: 1 addition & 0 deletions api/scraper/marks.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,5 +195,6 @@ exports.scrapeMarks = function (app, data, callback) {
CookieJar.add(unirest.cookie(cookieSerial), marksUri);
unirest.post(marksUri)
.jar(CookieJar)
.timeout(29000)
.end(onRequest);
};
1 change: 1 addition & 0 deletions api/scraper/timetable.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,5 +183,6 @@ exports.scrapeTimetable = function (app, data, callback) {
CookieJar.add(unirest.cookie(cookieSerial), timetableUri);
unirest.post(timetableUri)
.jar(CookieJar)
.timeout(29000)
.end(onRequest);
};
2 changes: 1 addition & 1 deletion api/status.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ var error = {
tokenExpired: {message: 'Token expired', code: 14},
noData: {message: 'Requested data is not available', code: 15},
toDo: {message: 'This feature is incomplete', code: 50},
vitDown: {message: 'VIT\'s servers may be down or we may be facing a connectivity issue', code: 89},
vitDown: {message: 'VIT\'s servers may be slowed down or we may be facing a connectivity issue', code: 89},
mongoDown: {message: 'Our MongoDB instance may be down or we may be facing a connectivity issue', code: 97},
maintenance: {message: 'Our backend servers are down for maintenance', code: 98},
other: {message: 'An unforeseen error has occurred', code: 99}
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "VITacademics",
"version": "0.13.18",
"version": "0.13.19",
"description": "VITacademics Backend and Web App",
"bugs": {
"url": "https://github.com/aneesh-neelam/VITacademics/issues",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "VITacademics",
"version": "0.13.18",
"version": "0.13.19",
"description": "VITacademics Backend and Web App",
"homepage": "http://vitacademics-dev.herokuapp.com/",
"bugs": {
Expand Down
2 changes: 1 addition & 1 deletion routes/web.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ router.get('/status', function (req, res) {
platform: process.platform,
arch: process.arch,
serverStatus: 'OK',
lastUpdated: '12th February 2015',
lastUpdated: '13th February 2015',
googleAnalyticsToken: googleAnalyticsToken
};
res.render('status', status);
Expand Down

0 comments on commit 9cd7270

Please sign in to comment.