From 548911eb9c4f9d2d5fd8540eccf2971431c651a0 Mon Sep 17 00:00:00 2001 From: Mrs4s <1844812067@qq.com> Date: Mon, 3 Aug 2020 17:40:45 +0800 Subject: [PATCH] update. --- utils/ttl.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/utils/ttl.go b/utils/ttl.go index 9a7c6d42..65766f49 100644 --- a/utils/ttl.go +++ b/utils/ttl.go @@ -7,7 +7,7 @@ import ( type TTList struct { list []*item - lock *sync.Mutex + lock sync.Mutex } type item struct { @@ -16,9 +16,7 @@ type item struct { } func NewTTList(ttl int64) *TTList { - l := &TTList{ - lock: new(sync.Mutex), - } + l := &TTList{} go func() { for now := range time.Tick(time.Second * 5) { l.lock.Lock()