timeout heruistics improved
This commit is contained in:
parent
4e11173a8a
commit
8f8155b2e6
|
@ -1,7 +1,7 @@
|
||||||
var JsonRPC = function(conf) {
|
var JsonRPC = function(conf) {
|
||||||
if (!this instanceof JsonRPC)
|
if (!this instanceof JsonRPC)
|
||||||
return new JsonRPC();
|
return new JsonRPC();
|
||||||
this.avgTimeout = 1000;
|
this.avgTimeout = 2000;
|
||||||
this.serverConf = conf;
|
this.serverConf = conf;
|
||||||
};
|
};
|
||||||
JsonRPC.prototype = {
|
JsonRPC.prototype = {
|
||||||
|
@ -10,9 +10,10 @@ JsonRPC.prototype = {
|
||||||
},
|
},
|
||||||
ariaRequest: function(url, multicall, funcName, params, success, error) {
|
ariaRequest: function(url, multicall, funcName, params, success, error) {
|
||||||
var startTime = new Date();
|
var startTime = new Date();
|
||||||
|
var conn = this;
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: url,
|
url: url,
|
||||||
timeout: 1000,
|
timeout: this.avgTimeout,
|
||||||
data: {
|
data: {
|
||||||
jsonrpc: 2.0,
|
jsonrpc: 2.0,
|
||||||
id: 'webui',
|
id: 'webui',
|
||||||
|
@ -20,7 +21,7 @@ JsonRPC.prototype = {
|
||||||
params: params.length ? this.encode(params) : undefined
|
params: params.length ? this.encode(params) : undefined
|
||||||
},
|
},
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
this.avgTimeout = 3 * (new Date() - startTime);
|
conn.avgTimeout = 3 * (new Date() - startTime);
|
||||||
return success(data)
|
return success(data)
|
||||||
},
|
},
|
||||||
error: error,
|
error: error,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user