Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lpxxn/grpc-pool
simple grpc client connection pool
https://github.com/lpxxn/grpc-pool
grpc-go grpc-pool
Last synced: 19 days ago
JSON representation
simple grpc client connection pool
- Host: GitHub
- URL: https://github.com/lpxxn/grpc-pool
- Owner: lpxxn
- Created: 2019-05-29T02:15:23.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-12-09T02:22:14.000Z (about 5 years ago)
- Last Synced: 2024-10-29T22:38:16.953Z (2 months ago)
- Topics: grpc-go, grpc-pool
- Language: Go
- Homepage:
- Size: 13.7 KB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## 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()
```