Setup ajax timeout to 2 minutes to allow long running queries

This commit is contained in:
Dan Sosedoff
2016-01-21 20:13:12 -06:00
parent d53c94eb91
commit 5e47e8bd29
2 changed files with 10 additions and 3 deletions

View File

@@ -59,7 +59,10 @@ function getPagesCount(rowsCount) {
}
function apiCall(method, path, params, cb) {
var timeout = 120000; // 2 mins is enough
$.ajax({
timeout: timeout,
url: "/api" + path,
method: method,
cache: false,
@@ -71,6 +74,10 @@ function apiCall(method, path, params, cb) {
cb(data);
},
error: function(xhr, status, data) {
if (status == "timeout") {
return cb({ error: "Query timeout after " + (timeout / 1000) + "s" });
}
cb(jQuery.parseJSON(xhr.responseText));
}
});