Skip to content

Commit

Permalink
Fix lru test
Browse files Browse the repository at this point in the history
  • Loading branch information
nekohasekai committed Dec 10, 2024
1 parent 9571667 commit 73776cf
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions contrab/freelru/lru_test.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package freelru_test

import (
"github.com/sagernet/sing/common"
F "github.com/sagernet/sing/common/format"
"math/rand/v2"
"math/rand"
"testing"
"time"

"github.com/sagernet/sing/common"
F "github.com/sagernet/sing/common/format"
"github.com/sagernet/sing/contrab/freelru"
"github.com/sagernet/sing/contrab/maphash"

Expand Down Expand Up @@ -89,7 +89,7 @@ func TestPurgeExpired(t *testing.T) {
}
})
for i := 0; i < 100; i++ {
lru.AddWithLifetime("hello_"+F.ToString(i), common.Ptr("world_"+F.ToString(i)), time.Duration(rand.Int32N(3000))*time.Millisecond)
lru.AddWithLifetime("hello_"+F.ToString(i), common.Ptr("world_"+F.ToString(i)), time.Duration(rand.Intn(3000))*time.Millisecond)
}
for i := 0; i < 5; i++ {
time.Sleep(time.Second)
Expand Down

0 comments on commit 73776cf

Please sign in to comment.