Skip to content

lpxxn/grpc-pool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 

Repository files navigation

simple grpc client connection pool

newClient := func() (*grpc.ClientConn, error) {
    opts := []grpc.DialOption{grpc.WithInsecure(), grpc.WithBlock()}
    return grpc.Dial("your connection address", opts...)
}
pool := NewGrpcPool(newClient, 10, time.Second*30)
con, err := pool.GetConn()
if err != nil {
    panic(err)
}
if con.GetState() != connectivity.Ready {
    panic("client not ready")
}
con.Release()

pool.CloseAllConn()

About

simple grpc client connection pool

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages