Skip to content

Commit

Permalink
fix: client blocking when connecting (#131)
Browse files Browse the repository at this point in the history
  • Loading branch information
veezhang authored Nov 30, 2022
1 parent 748b8f0 commit 8ae8bd9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ccore/nebula/gateway/pool/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,6 @@ func ListParams(args string, tmpParameter types.ParameterMap, sessionMap types.P

func NewClient(address string, port int, username string, password string, opts ...nebula.Option) (*ClientInfo, error) {
var err error
clientMux.Lock()
defer clientMux.Unlock()

// TODO: it's better to add a schedule to make it instead
if currentClientNum > clientRecycleNum {
Expand Down Expand Up @@ -253,8 +251,11 @@ func NewClient(address string, port int, username string, password string, opts
},
timezone: c.GetTimezoneInfo(),
}

clientMux.Lock()
clientPool[nsid] = client
currentClientNum++
clientMux.Unlock()

// Make a goroutine to deal with concurrent requests from each connection
go handleRequest(nsid)
Expand Down

0 comments on commit 8ae8bd9

Please sign in to comment.