Do not double call termContext in QueryEx
QueryEx was calling termContext and rows.fatal on err of sendPreparedQuery. rows.fatal calls rows.Close which already calls termContext. This sequence of calls was causing underlying io timeout errors to be returned instead of context errors. In addition, added fatalWriteErr helper method to allow recovery of write timeout errors where no bytes were written. This should solve flickering errors on Travis.
This commit is contained in:
@@ -398,16 +398,15 @@ func (c *Conn) QueryEx(ctx context.Context, sql string, options *QueryExOptions,
|
||||
err = c.initContext(ctx)
|
||||
if err != nil {
|
||||
rows.fatal(err)
|
||||
return rows, err
|
||||
return rows, rows.err
|
||||
}
|
||||
|
||||
err = c.sendPreparedQuery(ps, args...)
|
||||
if err != nil {
|
||||
rows.fatal(err)
|
||||
err = c.termContext(err)
|
||||
}
|
||||
|
||||
return rows, err
|
||||
return rows, rows.err
|
||||
}
|
||||
|
||||
func (c *Conn) sanitizeAndSendSimpleQuery(sql string, args ...interface{}) (err error) {
|
||||
|
||||
Reference in New Issue
Block a user