1
0
mirror of https://github.com/Mrs4s/MiraiGo.git synced 2025-05-04 11:07:40 +08:00
This commit is contained in:
Mrs4s 2020-08-03 17:40:45 +08:00
parent 6484727e59
commit 548911eb9c

View File

@ -7,7 +7,7 @@ import (
type TTList struct { type TTList struct {
list []*item list []*item
lock *sync.Mutex lock sync.Mutex
} }
type item struct { type item struct {
@ -16,9 +16,7 @@ type item struct {
} }
func NewTTList(ttl int64) *TTList { func NewTTList(ttl int64) *TTList {
l := &TTList{ l := &TTList{}
lock: new(sync.Mutex),
}
go func() { go func() {
for now := range time.Tick(time.Second * 5) { for now := range time.Tick(time.Second * 5) {
l.lock.Lock() l.lock.Lock()