Skip to content
This repository has been archived by the owner on Jan 28, 2021. It is now read-only.

Commit

Permalink
Restore default timeout and readTimeout values
Browse files Browse the repository at this point in the history
Signed-off-by: Juanjo Alvarez <juanjo@sourced.tech>
  • Loading branch information
Juanjo Alvarez committed Aug 12, 2019
1 parent 6659d13 commit a37b443
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions server/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,16 +129,15 @@ func (h *Handler) ComQuery(
}
}()

// Default (big) waitTime is 3600, but it wont matter if there is no timeout
// because the loop will just iterate again. If there is a timeout, it will
// Default (big) waitTime is one hour if there is not timeout configured, in which case
// it will loop to iterate again. If there is a timeout, it will
// be enforced to ensure that Vitess has a chance to call Handler.CloseConnection()
totalTime := 0 * time.Second
waitTime := 10 * time.Second
waitTime := 1 * time.Hour

if h.readTimeout > 0 {
waitTime = h.readTimeout
}
timer := time.NewTimer(waitTime)
timer := time.NewTimer(h.readTimeout)

rowLoop:
for {
Expand Down Expand Up @@ -173,8 +172,7 @@ rowLoop:
r.Rows = append(r.Rows, outputRow)
r.RowsAffected++
case <-timer.C:
totalTime += waitTime
if h.readTimeout != 0 && totalTime >= h.readTimeout {
if h.readTimeout != 0 && waitTime >= h.readTimeout {
// Return so Vitess can call the CloseConnection callback
err = RowTimeout.New()
close(quit)
Expand Down

0 comments on commit a37b443

Please sign in to comment.