comparison proxy_cache_lock_ssi.t @ 1031:be45fa007655

Tests: fixed test preconditions in proxy_cache_lock_ssi.t. Made sure that a proper request order exists between /locked and /ssi. Previously, request /locked could be proxied after subrequest /active, losing in the limit_req race. Also, request /locked was not properly delayed, thus proxy cache lock could not happen later in a subrequest. This somewhat reverts 714668aea2b0 as now inapplicable. While there, fixed a typo.
author Sergey Kandaurov <pluknet@nginx.com>
date Wed, 14 Sep 2016 17:30:58 +0300
parents 196d33c2bb45
children
comparison
equal deleted inserted replaced
1030:094e1247740f 1031:be45fa007655
49 49
50 proxy_cache_lock on; 50 proxy_cache_lock on;
51 proxy_cache_lock_timeout 100ms; 51 proxy_cache_lock_timeout 100ms;
52 52
53 proxy_read_timeout 3s; 53 proxy_read_timeout 3s;
54
55 add_header X-Msec $msec;
56 } 54 }
57 55
58 location = /ssi.html { 56 location = /ssi.html {
59 ssi on; 57 ssi on;
60 } 58 }
81 79
82 $t->run(); 80 $t->run();
83 81
84 ############################################################################### 82 ###############################################################################
85 83
86 # problem: if proxy cache lock wakeup happens in a an inactive 84 # problem: if proxy cache lock wakeup happens in an inactive
87 # subrequest, just a connection write event may not trigger any 85 # subrequest, just a connection write event may not trigger any
88 # further work 86 # further work
89 87
90 # main request -> subrequest /active (waiting for a backend), 88 # main request -> subrequest /active (waiting for a backend),
91 # -> subrequest /locked (locked by another request) 89 # -> subrequest /locked (locked by another request)
92 90
93 # this doesn't result in an infinite timeout as second subrequest 91 # this doesn't result in an infinite timeout as second subrequest
94 # is woken up by the postpone filter once first subrequest completes, 92 # is woken up by the postpone filter once first subrequest completes,
95 # but this is suboptimal behaviour 93 # but this is suboptimal behaviour
96 94
95 http_get('/charge');
96 my $start = time();
97
97 my $s = http_get('/locked', start => 1); 98 my $s = http_get('/locked', start => 1);
99 select undef, undef, undef, 0.2;
100
98 like(http_get('/ssi.html'), qr/end/, 'cache lock ssi'); 101 like(http_get('/ssi.html'), qr/end/, 'cache lock ssi');
99 my ($start) = http_end($s) =~ /X-Msec: (\d+)/; 102 http_end($s);
100 cmp_ok(time() - $start, '<=', 5, 'parallel execution after lock timeout'); 103 cmp_ok(time() - $start, '<=', 5, 'parallel execution after lock timeout');
101 104
102 ############################################################################### 105 ###############################################################################