Skip to content

[Feature Request]: Add a close method to HttpClient #4296

Open
@llmadd

Description

@llmadd

Describe the problem

@app.get("/get_collections")
async def get_collections():
    try:
        client = HttpClient(host="127.0.0.1", port=8800)
        response = client.list_collections()
        result = []
        for i in response:
            temp = {
                "id": i.id,
                "name":i.name,
                "count":await i.count()
            }
            result.append(temp)
        return result
    except Exception as e:
        raise

When I encapsulate ChromaDB-related services as APIs using FastAPI, each API call generates a new TCP connection that isn't released after completion. During frequent 'add' operations, this leads to a massive accumulation of temporary ports being occupied, eventually causing the process to freeze.

Image

While AsyncHttpClient doesn't have this issue, I want to add an explicit close() method to HttpClient for actively terminating requests.

Describe the proposed solution

I want to add a ​close method to the client to improve request management.

Alternatives considered

No response

Importance

would make my life easier

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions