Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

session销毁部分的time.AfterFunc函数问题 #1193

Open
jking412 opened this issue Oct 15, 2022 · 0 comments
Open

session销毁部分的time.AfterFunc函数问题 #1193

jking412 opened this issue Oct 15, 2022 · 0 comments

Comments

@jking412
Copy link

func (manager *Manager) GC() {
	manager.lock.Lock()
	defer manager.lock.Unlock()
	time.AfterFunc(time.Duration(manager.maxLifeTime), func() { manager.provider.SessionGC(manager.maxLifeTime) })
}

time.AfterFunc第一个时间参数的单位是纳秒,根据上下文信息,这里是否应该乘上time.Second,如下所示

func (manager *Manager) GC() {
	manager.lock.Lock()
	defer manager.lock.Unlock()
	time.AfterFunc(time.Duration(manager.maxLifeTime)*time.Second, func() { manager.provider.SessionGC(manager.maxLifeTime) })
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant