Merge pull request #29 from owncloud/fix-new-client-pool

This commit is contained in:
Alex Unger
2020-08-04 16:00:38 +02:00
committed by GitHub
2 changed files with 11 additions and 2 deletions
@@ -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
+4 -2
View File
@@ -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)
}