You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ha...@apache.org on 2022/11/02 04:06:09 UTC

[iotdb-client-go] branch rel/0.13 updated: [To rel/0.13] fix 'connectionTimeoutInMs' mismatch with actual usage (#58)

This is an automated email from the ASF dual-hosted git repository.

haonan pushed a commit to branch rel/0.13
in repository https://gitbox.apache.org/repos/asf/iotdb-client-go.git


The following commit(s) were added to refs/heads/rel/0.13 by this push:
     new 8819710  [To rel/0.13] fix 'connectionTimeoutInMs' mismatch with actual usage (#58)
8819710 is described below

commit 8819710a1c34fac4e8e1be5d1d3b1c0cf543c948
Author: 橘子 <70...@users.noreply.github.com>
AuthorDate: Tue Nov 1 21:06:04 2022 -0700

    [To rel/0.13] fix 'connectionTimeoutInMs' mismatch with actual usage (#58)
---
 README.md         | 11 +++++++++++
 README_ZH.md      |  8 ++++++++
 client/session.go |  2 +-
 3 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/README.md b/README.md
index 372c42a..ac6e808 100644
--- a/README.md
+++ b/README.md
@@ -93,3 +93,14 @@ go run session_example.go
 * make >= 3.0
 * curl >= 7.1.1
 * thrift 0.14.1
+
+## Troubleshooting
+
+### 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.
diff --git a/README_ZH.md b/README_ZH.md
index 953d7d7..dfbb0dc 100644
--- a/README_ZH.md
+++ b/README_ZH.md
@@ -76,3 +76,11 @@ go run session_example.go
 * make   >= 3.0
 * curl   >= 7.1.1
 * thrift 0.14.1
+
+## 疑难解答
+
+### Open函数参数名称与实际功能不匹配的问题
+
+函数```client/session.go/Open()```有一个参数`connectionTimeoutInMs`,表示了以毫秒为单位的连接超时时间。
+但旧版本中,该函数在实现时并未正确进行单位转换,而是将其看作了纳秒。现在该问题已修复。
+当该参数为0时,表示不设置超时时间;当设置为正数时表示以毫秒为单位的超时时间。
diff --git a/client/session.go b/client/session.go
index 55739c6..4572e27 100644
--- a/client/session.go
+++ b/client/session.go
@@ -80,7 +80,7 @@ func (s *Session) Open(enableRPCCompression bool, connectionTimeoutInMs int) err
 	var err error
 
 	s.trans, err = 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