mirror of
https://github.com/Mrs4s/MiraiGo.git
synced 2025-05-04 11:07:40 +08:00
fix ttl panic.
This commit is contained in:
parent
a7761bfb75
commit
683ad4b6cb
@ -40,7 +40,7 @@ func NewTTList(ttl int64) *TTList {
|
||||
|
||||
func (l *TTList) Add(i interface{}) {
|
||||
l.lock.Lock()
|
||||
l.lock.Unlock()
|
||||
defer l.lock.Unlock()
|
||||
l.list = append(l.list, &item{
|
||||
i: i,
|
||||
lastAccess: time.Now().Unix(),
|
||||
@ -49,7 +49,7 @@ func (l *TTList) Add(i interface{}) {
|
||||
|
||||
func (l *TTList) Any(filter func(i interface{}) bool) bool {
|
||||
l.lock.Lock()
|
||||
l.lock.Unlock()
|
||||
defer l.lock.Unlock()
|
||||
for _, it := range l.list {
|
||||
if filter(it.i) {
|
||||
it.lastAccess = time.Now().Unix()
|
||||
|
Loading…
x
Reference in New Issue
Block a user