Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use ConnectTimeout for options message #1217

Merged
merged 1 commit into from
Oct 17, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,6 @@ func (s *Session) dial(host *HostInfo, cfg *ConnConfig, errorHandler ConnErrorHa
r: bufio.NewReader(conn),
cfg: cfg,
calls: make(map[int]*callReq),
timeout: cfg.Timeout,
version: uint8(cfg.ProtoVersion),
addr: conn.RemoteAddr().String(),
errorHandler: errorHandler,
Expand Down Expand Up @@ -232,11 +231,14 @@ func (s *Session) dial(host *HostInfo, cfg *ConnConfig, errorHandler ConnErrorHa
conn: c,
}

c.timeout = cfg.ConnectTimeout
if err := startup.setupConn(ctx); err != nil {
c.close()
return nil, err
}

c.timeout = cfg.Timeout

// dont coalesce startup frames
if s.cfg.WriteCoalesceWaitTime > 0 {
c.w = newWriteCoalescer(c.w, s.cfg.WriteCoalesceWaitTime, c.quit)
Expand Down
2 changes: 1 addition & 1 deletion conn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,7 @@ func TestQueryTimeout(t *testing.T) {
if err != ErrTimeoutNoResponse {
t.Fatalf("expected to get %v for timeout got %v", ErrTimeoutNoResponse, err)
}
case <-time.After(10*time.Millisecond + db.cfg.Timeout):
case <-time.After(40*time.Millisecond + db.cfg.Timeout):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any specific reason for 40 over 10?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When running the stress I go a failure out of 10000 without that. I assume this was happening before as well. I don't think it will make a difference in the travis tests

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, agree. Just was wondering what's happening that warrants the increase in the waiting there.

// ensure that the query goroutines have been scheduled
t.Fatalf("query did not timeout after %v", db.cfg.Timeout)
}
Expand Down