mirror of
http://github.com/valkey-io/valkey
synced 2024-11-23 20:00:00 +00:00
Fix timing issue in PSETEX/PEXPIRE sub-second expire tests (#10121)
These two tests have a high probability of failure on MacOS. Or it takes many retries to succeed. Keys often expire before we can access them. So this time we try to avoid this by reducing the time of the first `after`, or removeing the first `after`. The results of doing `20/81` and `0/101` are: - PEXPIRE (20/81): 1069/1949 - PEXPIREAT (20/81): 1093/1949 - PEXPIRE (0/101): 31936 / 31936 - PEXPIREAT (0/101): 31936 / 31936 The first number is the number of times that the test succeeded without any retries. The second number is the total number of executions. And we can see that `0/101` doesn't even need an extra retries. Also reduces the time required for testing. So in the end we chose `0/100`, i.e. remove the first `after`. As for `PEXPIREAT`, there is no failure, but we still changed it together, using `0/201`, after 2W tests, none of them failed.
This commit is contained in:
parent
d7aeb2ce5f
commit
26ef5132a6
@ -97,9 +97,8 @@ start_server {tags {"expire"}} {
|
|||||||
for {set j 0} {$j < 50} {incr j} {
|
for {set j 0} {$j < 50} {incr j} {
|
||||||
r del x
|
r del x
|
||||||
r psetex x 100 somevalue
|
r psetex x 100 somevalue
|
||||||
after 80
|
|
||||||
set a [r get x]
|
set a [r get x]
|
||||||
after 120
|
after 101
|
||||||
set b [r get x]
|
set b [r get x]
|
||||||
|
|
||||||
if {$a eq {somevalue} && $b eq {}} break
|
if {$a eq {somevalue} && $b eq {}} break
|
||||||
@ -114,9 +113,8 @@ start_server {tags {"expire"}} {
|
|||||||
for {set j 0} {$j < 50} {incr j} {
|
for {set j 0} {$j < 50} {incr j} {
|
||||||
r set x somevalue
|
r set x somevalue
|
||||||
r pexpire x 100
|
r pexpire x 100
|
||||||
after 80
|
|
||||||
set c [r get x]
|
set c [r get x]
|
||||||
after 120
|
after 101
|
||||||
set d [r get x]
|
set d [r get x]
|
||||||
|
|
||||||
if {$c eq {somevalue} && $d eq {}} break
|
if {$c eq {somevalue} && $d eq {}} break
|
||||||
@ -132,9 +130,8 @@ start_server {tags {"expire"}} {
|
|||||||
r set x somevalue
|
r set x somevalue
|
||||||
set now [r time]
|
set now [r time]
|
||||||
r pexpireat x [expr ([lindex $now 0]*1000)+([lindex $now 1]/1000)+200]
|
r pexpireat x [expr ([lindex $now 0]*1000)+([lindex $now 1]/1000)+200]
|
||||||
after 20
|
|
||||||
set e [r get x]
|
set e [r get x]
|
||||||
after 220
|
after 201
|
||||||
set f [r get x]
|
set f [r get x]
|
||||||
|
|
||||||
if {$e eq {somevalue} && $f eq {}} break
|
if {$e eq {somevalue} && $f eq {}} break
|
||||||
|
Loading…
Reference in New Issue
Block a user