mirror of
https://github.com/jackc/pgx.git
synced 2025-05-31 11:42:24 +00:00
Avoid race between close conn and cancel ctx
This commit is contained in:
parent
3ec395d4ef
commit
8bad186207
@ -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")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user