Skip to content

Consider exposing a Close function on elasticsearch.Client #875

@codefromthecrypt

Description

@codefromthecrypt

elasticsearch.Client should consider a Close function as its elastictransport.Client does a couple things, which at least for unit tests may be best to stop explicitly. We may also want to accept a context on New for similar reasons.

Starts the goroutine client.DiscoverNodes: This may want to be cancelable, e.g. passing a context to the New function. Agree this is not typical, but personally I pass ctx into New functions that perform I/O.

Via elastic-transport-go, starts a self-scheduling function for discovery: On Close, this should be stopped explicitly somehow, or documented why that's not required.

I didn't mention the edge case of http transport, that we have an opportunity to CloseIdleConnections, as I think above are more important to rule in or out.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions