Skip to content

How to close client pool ? #794

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
RainJoe opened this issue Jun 1, 2023 · 1 comment
Closed

How to close client pool ? #794

RainJoe opened this issue Jun 1, 2023 · 1 comment

Comments

@RainJoe
Copy link
Contributor

RainJoe commented Jun 1, 2023

import (
    "github.com/go-mysql-org/go-mysql/client"
)

pool := client.NewPool(log.Debugf, 100, 400, 5, "127.0.0.1:3306", `root`, ``, `test`)
// ...
conn, _ := pool.GetConn(ctx)
defer pool.PutConn(conn)

conn.Execute() / conn.Begin() / etc...

In some usecases, we want to close the pool and also close the underlying mysql connections to avoid resource leaks, but I didn't find a method like pool.Close to implement it.

@lance6716
Copy link
Collaborator

yes currently we don't have this feature. You can open a PR to implement it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants