Avoid race between close conn and cancel ctx
This commit is contained in:
+2
-3
@@ -366,12 +366,11 @@ func TestSendBatchSimpleProtocol(t *testing.T) {
|
|||||||
config := mustParseConfig(t, os.Getenv("PGX_TEST_DATABASE"))
|
config := mustParseConfig(t, os.Getenv("PGX_TEST_DATABASE"))
|
||||||
config.PreferSimpleProtocol = true
|
config.PreferSimpleProtocol = true
|
||||||
|
|
||||||
conn := mustConnect(t, config)
|
|
||||||
defer closeConn(t, conn)
|
|
||||||
|
|
||||||
ctx, cancelFunc := context.WithCancel(context.Background())
|
ctx, cancelFunc := context.WithCancel(context.Background())
|
||||||
defer cancelFunc()
|
defer cancelFunc()
|
||||||
|
|
||||||
|
conn := mustConnect(t, config)
|
||||||
|
defer closeConn(t, conn)
|
||||||
|
|
||||||
var batch pgx.Batch
|
var batch pgx.Batch
|
||||||
batch.Queue("SELECT 1::int")
|
batch.Queue("SELECT 1::int")
|
||||||
|
|||||||
Reference in New Issue
Block a user