فهرست منبع

Merge pull request #644 from Zariel/fix-stream0-flakes

conn: closeWithError should always try to deliver
Chris Bannister 9 سال پیش
والد
کامیت
0a824fe58e
1فایلهای تغییر یافته به همراه5 افزوده شده و 7 حذف شده
  1. 5 7
      conn.go

+ 5 - 7
conn.go

@@ -328,18 +328,16 @@ func (c *Conn) closeWithError(err error) {
 		return
 	}
 
+	// we should attempt to deliver the error back to the caller if it
+	// exists
 	if err != nil {
-		// we should attempt to deliver the error back to the caller if it
-		// exists
 		c.mu.RLock()
 		for _, req := range c.calls {
 			// we need to send the error to all waiting queries, put the state
 			// of this conn into not active so that it can not execute any queries.
-			if err != nil {
-				select {
-				case req.resp <- err:
-				default:
-				}
+			select {
+			case req.resp <- err:
+			case <-req.timeout:
 			}
 		}
 		c.mu.RUnlock()