thrift节点js是否提供客户端时间或默认超时? 无法找到任何相关的例子。
使用以下客户端代码:
var thrift = require('thrift');
var MultiplicationService = require("./gen-nodejs/MultiplicationService");
var transport = thrift.TBufferedTransport;
var protocol = thrift.TBinaryProtocol;
var connection = thrift.createConnection("localhost", 9090, {
transport : transport,
protocol : protocol
});
connection.on('error', function(err) {
assert(false, err);
});
var client = thrift.createClient(MultiplicationService, connection);
client.multiply(2,3, function(err, response) {
console.log("2*3=" + response);
});
答案 0 :(得分:0)
您可以使用一些选项
var connection = thrift.createConnection("localhost", 9090, {
transport : transport,
protocol : protocol,
connect_timeout: 100,
max_attempts: 2
});