sessionPool使用的时候,session会一直增长?
songlong opened this issue · 4 comments
songlong commented
getIdleSession,这个地方判断,
} else if pool.activeSessions.Len() < pool.conf.maxSize {
这个地方感觉是准确的,这个时候,如果session满了,还会继续创建新的session出来的
songlong commented
不准确的
songlong commented
当设的最大的session个数大于host个数的时候,idleSessions会一直为0么?
那这个时候,岂不是会一直创建新的session出来?
HarrisChu commented
func (pool *SessionPool) getSessionFromIdle() (*pureSession, error) {
pool.rwLock.Lock()
defer pool.rwLock.Unlock()
// Get a session from the idle queue if possible
if pool.idleSessions.Len() > 0 {
session := pool.idleSessions.Front().Value.(*pureSession)
pool.idleSessions.Remove(pool.idleSessions.Front())
return session, nil
} else if pool.activeSessions.Len() < pool.conf.maxSize {
return nil, nil
}
else mean pool.idleSessions.Len() == 0