diff options
author | judeng <abc3844@126.com> | 2023-04-25 15:17:21 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-25 10:17:21 +0300 |
commit | 9b588f3820edd35d4cd44b69e96476095858fc06 (patch) | |
tree | f30ad6e927027636a3d5175090e2862b1873e969 /tests | |
parent | bedecec786767b84215f4002a02d18110585915a (diff) | |
download | redis-9b588f3820edd35d4cd44b69e96476095858fc06.tar.gz |
minor optimization for slowlog get (#12103)
We can always know the array length of the response, so there is no need to
use addReplyDeferredLen which may introduce some additional overheads.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/unit/slowlog.tcl | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/tests/unit/slowlog.tcl b/tests/unit/slowlog.tcl index bc15c6411..3c547b924 100644 --- a/tests/unit/slowlog.tcl +++ b/tests/unit/slowlog.tcl @@ -24,8 +24,11 @@ start_server {tags {"slowlog"} overrides {slowlog-log-slower-than 1000000}} { } {10} test {SLOWLOG - GET optional argument to limit output len works} { - llength [r slowlog get 5] - } {5} + + assert_equal 5 [llength [r slowlog get 5]] + assert_equal 10 [llength [r slowlog get -1]] + assert_equal 10 [llength [r slowlog get 20]] + } test {SLOWLOG - RESET subcommand works} { r config set slowlog-log-slower-than 100000 @@ -39,7 +42,7 @@ start_server {tags {"slowlog"} overrides {slowlog-log-slower-than 1000000}} { set e [lindex [r slowlog get] 0] assert_equal [llength $e] 6 if {!$::external} { - assert_equal [lindex $e 0] 105 + assert_equal [lindex $e 0] 107 } assert_equal [expr {[lindex $e 2] > 100000}] 1 assert_equal [lindex $e 3] {debug sleep 0.2} |