MCPcopy Create free account
hub / github.com/dolthub/doltgresql / handleErrorChannel

Method handleErrorChannel

testing/go/wire_test.go:7696–7719  ·  view source on GitHub ↗

handleErrorChannel handles errors while ensuring that stuck queries do not cause an infinite loop via a timeout.

(t *testing.T, isSend bool)

Source from the content-addressed store, hash-verified

7694
7695// handleErrorChannel handles errors while ensuring that stuck queries do not cause an infinite loop via a timeout.
7696func (c *RawWireConnection) handleErrorChannel(t *testing.T, isSend bool) error {
7697 var err error
7698 select {
7699 case err = <-c.errChan:
7700 case <-time.After(c.timeout):
7701 if isSend {
7702 err = errors.New("timeout during Send")
7703 } else {
7704 err = errors.New("timeout during Receive")
7705 }
7706 }
7707 // On error, we must create a new connection since we cut the old one
7708 if err != nil {
7709 _ = c.connection.Close()
7710 connection, nErr := (&net.Dialer{}).Dial("tcp", c.network)
7711 if nErr != nil {
7712 panic(fmt.Errorf("Unable to create a new connection:\n%s\n\nOriginal error:\n%s", nErr.Error(), err.Error()))
7713 }
7714 c.connection = connection
7715 c.frontend = pgproto3.NewFrontend(connection, connection)
7716 c.init(t)
7717 }
7718 return err
7719}
7720
7721// RunWireScripts runs the given collection of scripts.
7722func RunWireScripts(t *testing.T, scripts []WireScriptTest) {

Callers 2

ReceiveMethod · 0.95
SendMethod · 0.95

Calls 5

initMethod · 0.95
AfterMethod · 0.80
CloseMethod · 0.65
ErrorfMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected