@@ -51,14 +51,28 @@ type ClusterConfig struct {
51
51
// versions the protocol selected is not defined (ie, it can be any of the supported in the cluster)
52
52
ProtoVersion int
53
53
54
- // Connection timeout (default: 600ms)
54
+ // Timeout limits the time spent on the client side while executing a query.
55
+ // Specifically, query or batch execution will return an error if the client does not receive a response
56
+ // from the server within the Timeout period.
57
+ // Timeout is also used to configure the read timeout on the underlying network connection.
58
+ // Client Timeout should always be higher than the request timeouts configured on the server,
59
+ // so that retries don't overload the server.
60
+ // Timeout has a default value of 11 seconds, which is higher than default server timeout for most query types.
61
+ // Timeout is not applied to requests during initial connection setup, see ConnectTimeout.
55
62
Timeout time.Duration
56
63
57
- // Initial connection timeout, used during initial dial to server (default: 600ms)
58
- // ConnectTimeout is used to set up the default dialer and is ignored if Dialer or HostDialer is provided.
64
+ // ConnectTimeout limits the time spent during connection setup.
65
+ // During initial connection setup, internal queries, AUTH requests will return an error if the client
66
+ // does not receive a response within the ConnectTimeout period.
67
+ // ConnectTimeout is applied to the connection setup queries independently.
68
+ // ConnectTimeout also limits the duration of dialing a new TCP connection
69
+ // in case there is no Dialer nor HostDialer configured.
70
+ // ConnectTimeout has a default value of 11 seconds.
59
71
ConnectTimeout time.Duration
60
72
61
- // Timeout for writing a query. Defaults to Timeout if not specified.
73
+ // WriteTimeout limits the time the driver waits to write a request to a network connection.
74
+ // WriteTimeout should be lower than or equal to Timeout.
75
+ // WriteTimeout defaults to the value of Timeout.
62
76
WriteTimeout time.Duration
63
77
64
78
// Port used when dialing.
@@ -263,8 +277,8 @@ func NewCluster(hosts ...string) *ClusterConfig {
263
277
cfg := & ClusterConfig {
264
278
Hosts : hosts ,
265
279
CQLVersion : "3.0.0" ,
266
- Timeout : 600 * time .Millisecond ,
267
- ConnectTimeout : 600 * time .Millisecond ,
280
+ Timeout : 11 * time .Second ,
281
+ ConnectTimeout : 11 * time .Second ,
268
282
Port : 9042 ,
269
283
NumConns : 2 ,
270
284
Consistency : Quorum ,
0 commit comments