task 584: Add a timeout of 10 seconds for reconciliation service to respond

http://code.google.com/p/google-refine/issues/detail?id=584

git-svn-id: http://google-refine.googlecode.com/svn/trunk@2580 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
Tom Morris 2012-10-12 22:29:53 +00:00
parent 3ff52ba494
commit 12308c2840

View File

@ -75,34 +75,35 @@ ReconciliationManager.registerService = function(service) {
};
ReconciliationManager.registerStandardService = function(url, f) {
var dismissBusy = DialogSystem.showBusy();
var dismissBusy = DialogSystem.showBusy("Contacting reconciliation service...");
$.getJSON(
url + (url.contains("?") ? "&" : "?") + "callback=?",
null,
function(data) {
data.url = url;
data.ui = { "handler" : "ReconStandardServicePanel" };
index = ReconciliationManager.customServices.length +
ReconciliationManager.standardServices.length;
ReconciliationManager.standardServices.push(data);
ReconciliationManager._rebuildMap();
ReconciliationManager.save();
dismissBusy();
if (f) {
f(index);
}
},
"jsonp"
$.ajax(
url,
{ "dataType" : "jsonp",
"timeout":10000
}
)
.success(function(data, textStatus, jqXHR) {
data.url = url;
data.ui = { "handler" : "ReconStandardServicePanel" };
index = ReconciliationManager.customServices.length +
ReconciliationManager.standardServices.length;
ReconciliationManager.standardServices.push(data);
ReconciliationManager._rebuildMap();
ReconciliationManager.save();
dismissBusy();
if (f) {
f(index);
}
})
.error(function(jqXHR, textStatus, errorThrown) {
dismissBusy();
alert('Error contacting recon service: '+textStatus + ' : ' + errorThrown);
alert('Error contacting recon service: ' + textStatus + ' : ' + errorThrown + ' - ' + url);
});
};