@@ -503,8 +503,10 @@ GET /test
503
503
content_by_lua_block {
504
504
local dogs = ngx. shared. dogs
505
505
506
- local max
507
- for i = 1 , 10000 do
506
+ local N = 100000
507
+ local max = 0
508
+
509
+ for i = 1 , N do
508
510
local key = string. format(" %05d" , i)
509
511
510
512
local len , err = dogs: lpush(key , i)
@@ -516,20 +518,20 @@ GET /test
516
518
517
519
local keys = dogs: get_keys(0 )
518
520
519
- ngx. say (" max- 1 matched keys length: " , max- 1 == # keys)
521
+ ngx. say (" max - 1 matched keys length: " , max - 1 == # keys)
520
522
521
523
dogs: flush_all()
522
524
523
525
local keys = dogs: get_keys(0 )
524
526
525
527
ngx. say (" keys all expired, left number: " , # keys)
526
528
527
- for i = 10000 , 1 , -1 do
529
+ for i = 100000 , 1 , -1 do
528
530
local key = string. format(" %05d" , i)
529
531
530
532
local len, err = dogs: lpush(key , i)
531
533
if not len then
532
- ngx. say (" loop again, max matched: " , 10001 - i == max )
534
+ ngx. say (" loop again, max matched: " , N + 1 - i == max )
533
535
break
534
536
end
535
537
end
@@ -538,7 +540,7 @@ GET /test
538
540
539
541
dogs: flush_expired()
540
542
541
- for i = 1 , 10000 do
543
+ for i = 1 , N do
542
544
local key = string. format(" %05d" , i)
543
545
544
546
local len, err = dogs: lpush(key , i)
@@ -552,7 +554,7 @@ GET /test
552
554
--- request
553
555
GET /test
554
556
-- - response_body
555
- max- 1 matched keys length: true
557
+ max - 1 matched keys length: true
556
558
keys all expired, left number: 0
557
559
loop again, max matched: true
558
560
loop again, max matched: true
0 commit comments