mirror of https://github.com/tidwall/tile38.git
Fix expire test
This commit is contained in:
parent
0e1ae7b4bc
commit
b766792d82
|
@ -38,23 +38,13 @@ func TestBasic(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestRandomQueue(t *testing.T) {
|
func TestRandomQueue(t *testing.T) {
|
||||||
N := 100000
|
N := 1000
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
var list List
|
var list List
|
||||||
for i := 0; i < N; i++ {
|
for i := 0; i < N; i++ {
|
||||||
list.Push(&testItem{fmt.Sprintf("%d", i),
|
list.Push(&testItem{fmt.Sprintf("%d", i),
|
||||||
now.Add(time.Duration(rand.Float64() * float64(time.Second)))})
|
now.Add(time.Duration(rand.Float64() * float64(time.Second)))})
|
||||||
}
|
}
|
||||||
// var wg sync.WaitGroup
|
|
||||||
// wg.Add(N)
|
|
||||||
// var items []Item
|
|
||||||
// list.Expired = func(item Item) {
|
|
||||||
// items = append(items, item)
|
|
||||||
// wg.Done()
|
|
||||||
// }
|
|
||||||
|
|
||||||
// wg.Wait()
|
|
||||||
|
|
||||||
var items []Item
|
var items []Item
|
||||||
for list.queue.len > 0 {
|
for list.queue.len > 0 {
|
||||||
n1 := list.queue.peek()
|
n1 := list.queue.peek()
|
||||||
|
@ -77,7 +67,7 @@ func TestRandomQueue(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestExpires(t *testing.T) {
|
func TestExpires(t *testing.T) {
|
||||||
N := 100000
|
N := 1000
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
var list List
|
var list List
|
||||||
for i := 0; i < N; i++ {
|
for i := 0; i < N; i++ {
|
||||||
|
|
Loading…
Reference in New Issue