go-macaron / session

Package session is a middleware that provides the session management of Macaron.
Apache License 2.0
26 stars 27 forks source link

session包可能存在不过期的bug #2

Closed insionng closed 9 years ago

insionng commented 9 years ago

http://www.yougam.com/ 用了下面这句简单的获取当前激活的session来作为统计在线人数的代码

        self.Data["usersonline"] = sess.GetActiveSession()

但常发现在线人数可以飙升到几百上千,3千5千都见识过..但事实的真相是肯定不存在这么多人在线的..

insionng commented 9 years ago

刚发现 加上配置 并设定过期时间后可以成功删除过期session, 后续我再在线上运行一段时间看看效果如何.大概可能不设置配置的话,就是永久不过期的感觉...等验证了再来给差评.

insionng commented 9 years ago

已经确认session.Options不设置是不会过期的,起码是不会在3600s内过期,默认内里设定的过期时间成了摆设了.这应该是个bug吧,不过设置了session.Options就不会有问题.

unknwon commented 9 years ago

代码重新优化过,有待进一步论证。

insionng commented 9 years ago
 sess.GetActiveSession undefined (type session.Store has no field or method GetActiveSession)

更新后出现这错误,貌似 sess.GetActiveSession不在session.Store里.