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()
-
Notifications
You must be signed in to change notification settings - Fork 1
lpxxn/grpc-pool
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
simple grpc client connection pool
Topics
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published