luci-base: rpc.js: increase default timeout to 20s, allow batch prevention
Support a new option "nobatch: true" in rpc.declare() which prevents the underlying RPC call from being batched with other calls. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
This commit is contained in:
parent
afeacdc7df
commit
21d1266c53
1 changed files with 4 additions and 3 deletions
|
@ -6,7 +6,7 @@ var rpcRequestID = 1,
|
|||
rpcInterceptorFns = [];
|
||||
|
||||
return L.Class.extend({
|
||||
call: function(req, cb) {
|
||||
call: function(req, cb, nobatch) {
|
||||
var q = '';
|
||||
|
||||
if (Array.isArray(req)) {
|
||||
|
@ -26,7 +26,8 @@ return L.Class.extend({
|
|||
}
|
||||
|
||||
return L.Request.post(rpcBaseURL + q, req, {
|
||||
timeout: (L.env.rpctimeout || 5) * 1000,
|
||||
timeout: (L.env.rpctimeout || 20) * 1000,
|
||||
nobatch: nobatch,
|
||||
credentials: true
|
||||
}).then(cb, cb);
|
||||
},
|
||||
|
@ -167,7 +168,7 @@ return L.Class.extend({
|
|||
};
|
||||
|
||||
/* call rpc */
|
||||
rpc.call(msg, rpc.parseCallReply.bind(rpc, req));
|
||||
rpc.call(msg, rpc.parseCallReply.bind(rpc, req), options.nobatch);
|
||||
});
|
||||
}, this, this, options);
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue