Merge pull request #29 from owncloud/fix-new-client-pool
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
Bugfix: Fix file descriptor leak
|
||||
|
||||
Only use a single instance of go-micro's GRPC client as it already
|
||||
does connection pooling. This prevents connection and file descriptor leaks.
|
||||
|
||||
https://github.com/owncloud/ocis-accounts/issues/79
|
||||
https://github.com/owncloud/ocis-ocs/pull/29
|
||||
@@ -16,6 +16,8 @@ import (
|
||||
"github.com/owncloud/ocis-pkg/v2/log"
|
||||
)
|
||||
|
||||
var defaultClient = grpc.NewClient()
|
||||
|
||||
// Service defines the extension handlers.
|
||||
type Service interface {
|
||||
ServeHTTP(http.ResponseWriter, *http.Request)
|
||||
@@ -100,9 +102,9 @@ func (o Ocs) NotFound(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func (o Ocs) getAccountService() accounts.AccountsService {
|
||||
return accounts.NewAccountsService("com.owncloud.api.accounts", grpc.NewClient())
|
||||
return accounts.NewAccountsService("com.owncloud.api.accounts", defaultClient)
|
||||
}
|
||||
|
||||
func (o Ocs) getGroupsService() accounts.GroupsService {
|
||||
return accounts.NewGroupsService("com.owncloud.api.accounts", grpc.NewClient())
|
||||
return accounts.NewGroupsService("com.owncloud.api.accounts", defaultClient)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user