Skip to content

Commit

Permalink
fix 'connectionTimeoutInMs' mismatch with actual usage (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
citrusreticulata authored Nov 2, 2022
1 parent 6b079e5 commit 2731a9e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,3 +108,12 @@ The interfaces changed in the two versions are as follows:
2. `NewTFramedTransport` has been deprecated, use `NewTFramedTransportConf` instead.

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)

### Parameter name mismatch with actual usage in function 'Open'

The implementation of the function ```client/session.go/Open()``` is mismatched with the description.
The parameter `connectionTimeoutInMs` represents connection timeout in milliseconds.
However, in the older version, this function did not implement correctly, regarding it as nanosecond instead.
The bug is now fixed.
Positive value of this parameter means connection timeout in milliseconds.
Set 0 for no timeout.
6 changes: 6 additions & 0 deletions README_ZH.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,9 @@ go run session_example.go
2. `NewTFramedTransport`已弃用,改用为`NewTFramedTransportConf`

更多相关的内容可以参考这个PR:[update thrift to 0.15.0 to fit IoTDB 0.13.0](https://github.com/apache/iotdb-client-go/pull/41)

### Open函数参数名称与实际功能不匹配的问题

函数```client/session.go/Open()```有一个参数`connectionTimeoutInMs`,表示了以毫秒为单位的连接超时时间。
但旧版本中,该函数在实现时并未正确进行单位转换,而是将其看作了纳秒。现在该问题已修复。
当该参数为0时,表示不设置超时时间;当设置为正数时表示以毫秒为单位的超时时间。
2 changes: 1 addition & 1 deletion client/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func (s *Session) Open(enableRPCCompression bool, connectionTimeoutInMs int) err

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

0 comments on commit 2731a9e

Please sign in to comment.