mirror of
https://github.com/v2ray/v2ray-core.git
synced 2026-11-24 23:19:44 +00:00
improve timed queue performance
This commit is contained in:
1 parent
8f9b23a6ab
commit
d1fecba6e4
3 files changed
+50
-50
No files matched your search
@@ -14,14 +14,9 @@ func TestTimedQueue(t *testing.T) {
|
||||
removed := make(map[string]bool)
|
||||
|
||||
nowSec := time.Now().Unix()
|
||||
q := NewTimedQueue(2)
|
||||
|
||||
go func() {
|
||||
for {
|
||||
entry := <-q.RemovedEntries()
|
||||
removed[entry.(string)] = true
|
||||
}
|
||||
}()
|
||||
q := NewTimedQueue(2, func(v interface{}) {
|
||||
removed[v.(string)] = true
|
||||
})
|
||||
|
||||
q.Add("Value1", nowSec)
|
||||
q.Add("Value2", nowSec+5)
|
||||
|
||||
Reference in new issue
Block a user