diff options
author | Jo-Philipp Wich <jo@mein.io> | 2019-09-21 10:21:15 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2019-09-21 10:23:37 +0200 |
commit | 21d1266c53d07f02c3b24314c62e86f2fa82fe9b (patch) | |
tree | 3b4c2ba2a3021b11f68423e078833b785806f907 /modules/luci-base/htdocs/luci-static/resources | |
parent | afeacdc7df181a592bea2109497400427e6471be (diff) |
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>
Diffstat (limited to 'modules/luci-base/htdocs/luci-static/resources')
-rw-r--r-- | modules/luci-base/htdocs/luci-static/resources/rpc.js | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/modules/luci-base/htdocs/luci-static/resources/rpc.js b/modules/luci-base/htdocs/luci-static/resources/rpc.js index 87850b856..9c74bfdaf 100644 --- a/modules/luci-base/htdocs/luci-static/resources/rpc.js +++ b/modules/luci-base/htdocs/luci-static/resources/rpc.js @@ -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); }, |