Skip to content

dial context shall be dial timeout context in connector.go #1034

Closed
@zjj

Description

@zjj

Issue description

the ctx for dial or DialContext shall some context that from cfg.Timeout // Dial timeout,
but not the context from open.

Example code

connector.go

/ Connect implements driver.Connector interface.
// Connect returns a connection to the database.
func (c *connector) Connect(ctx context.Context) (driver.Conn, error) {
	...
	if ok {
		mc.netConn, err = dial(ctx, mc.cfg.Addr)
	} else {
		nd := net.Dialer{Timeout: mc.cfg.Timeout}
		mc.netConn, err = nd.DialContext(ctx, mc.cfg.Net, mc.cfg.Addr)
	}

	...

Error log

n/a

Configuration

current master b4242ba

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions