Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement the new encoding with 64bit size and expire time in milliseconds #1342

Merged
merged 27 commits into from
Mar 23, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix
PragmaTwice committed Mar 22, 2023
commit 1f7f60da31aaf7c43f6a35cc417c427cffc89f62
12 changes: 6 additions & 6 deletions tests/gocase/unit/expire/expire_test.go
Original file line number Diff line number Diff line change
@@ -42,7 +42,7 @@ func TestExpire(t *testing.T) {
require.True(t, rdb.Expire(ctx, "x", 5*time.Second).Val())
util.BetweenValues(t, rdb.TTL(ctx, "x").Val(), 4*time.Second, 5*time.Second)
require.True(t, rdb.Expire(ctx, "x", 10*time.Second).Val())
require.Equal(t, 10*time.Second, rdb.TTL(ctx, "x").Val())
util.BetweenValues(t, rdb.TTL(ctx, "x").Val().Seconds(), 9, 10)
require.NoError(t, rdb.Expire(ctx, "x", 2*time.Second).Err())
})

@@ -128,7 +128,7 @@ func TestExpire(t *testing.T) {
require.NoError(t, rdb.PExpire(ctx, "x", 100*time.Millisecond).Err())
time.Sleep(50 * time.Millisecond)
a := rdb.Get(ctx, "x").Val()
time.Sleep(2 * time.Second)
time.Sleep(500 * time.Millisecond)
b := rdb.Get(ctx, "x").Val()
return a == "somevalue" && b == ""
}, 3)
@@ -138,10 +138,10 @@ func TestExpire(t *testing.T) {
util.RetryEventually(t, func() bool {
require.NoError(t, rdb.Del(ctx, "x").Err())
require.NoError(t, rdb.Set(ctx, "x", "somevalue", 0).Err())
require.NoError(t, rdb.PExpireAt(ctx, "x", time.UnixMilli(time.Now().Unix()*1000+100)).Err())
time.Sleep(50 * time.Millisecond)
require.NoError(t, rdb.PExpireAt(ctx, "x", time.UnixMilli(time.Now().Unix()*1000+1500)).Err())
time.Sleep(800 * time.Millisecond)
a := rdb.Get(ctx, "x").Val()
time.Sleep(2 * time.Second)
time.Sleep(800 * time.Millisecond)
b := rdb.Get(ctx, "x").Val()
return a == "somevalue" && b == ""
}, 3)
@@ -153,7 +153,7 @@ func TestExpire(t *testing.T) {
require.NoError(t, rdb.Set(ctx, "x", "somevalue", 100*time.Millisecond).Err())
time.Sleep(50 * time.Millisecond)
a := rdb.Get(ctx, "x").Val()
time.Sleep(2 * time.Second)
time.Sleep(500 * time.Millisecond)
b := rdb.Get(ctx, "x").Val()
return a == "somevalue" && b == ""
}, 3)