Skip to content

Commit 2731a9e

Browse files
fix 'connectionTimeoutInMs' mismatch with actual usage (#57)
1 parent 6b079e5 commit 2731a9e

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,3 +108,12 @@ The interfaces changed in the two versions are as follows:
108108
2. `NewTFramedTransport` has been deprecated, use `NewTFramedTransportConf` instead.
109109

110110
For more details, please take a look at this PR: [update thrift to 0.15.0 to fit IoTDB 0.13.0](https://github.com/apache/iotdb-client-go/pull/41)
111+
112+
### Parameter name mismatch with actual usage in function 'Open'
113+
114+
The implementation of the function ```client/session.go/Open()``` is mismatched with the description.
115+
The parameter `connectionTimeoutInMs` represents connection timeout in milliseconds.
116+
However, in the older version, this function did not implement correctly, regarding it as nanosecond instead.
117+
The bug is now fixed.
118+
Positive value of this parameter means connection timeout in milliseconds.
119+
Set 0 for no timeout.

README_ZH.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,3 +104,9 @@ go run session_example.go
104104
2. `NewTFramedTransport`已弃用,改用为`NewTFramedTransportConf`
105105

106106
更多相关的内容可以参考这个PR:[update thrift to 0.15.0 to fit IoTDB 0.13.0](https://github.com/apache/iotdb-client-go/pull/41)
107+
108+
### Open函数参数名称与实际功能不匹配的问题
109+
110+
函数```client/session.go/Open()```有一个参数`connectionTimeoutInMs`,表示了以毫秒为单位的连接超时时间。
111+
但旧版本中,该函数在实现时并未正确进行单位转换,而是将其看作了纳秒。现在该问题已修复。
112+
当该参数为0时,表示不设置超时时间;当设置为正数时表示以毫秒为单位的超时时间。

client/session.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ func (s *Session) Open(enableRPCCompression bool, connectionTimeoutInMs int) err
8181

8282
// in thrift 0.14.1, this func returns two values; in thrift 0.15.0, it returns one.
8383
s.trans = thrift.NewTSocketConf(net.JoinHostPort(s.config.Host, s.config.Port), &thrift.TConfiguration{
84-
ConnectTimeout: time.Duration(connectionTimeoutInMs), // Use 0 for no timeout
84+
ConnectTimeout: time.Duration(connectionTimeoutInMs) * time.Millisecond, // Use 0 for no timeout
8585
})
8686
if err != nil {
8787
return err

0 commit comments

Comments
 (0)