Tests: fixing racing condition in ASGI threads test.
ASGI threads read all the requests from the queue before start processing it. This why test need to wait a little to let the ASGI thread start request processing and block. In virtual environment any thread or process may be delayed and only method to avoid racing is a reasonable sleep increase.
This commit is contained in:
@@ -406,16 +406,16 @@ Connection: close
|
|||||||
self.load('threads')
|
self.load('threads')
|
||||||
|
|
||||||
assert 'success' in self.conf(
|
assert 'success' in self.conf(
|
||||||
'4', 'applications/threads/threads'
|
'2', 'applications/threads/threads'
|
||||||
), 'configure 4 threads'
|
), 'configure 2 threads'
|
||||||
|
|
||||||
socks = []
|
socks = []
|
||||||
|
|
||||||
for i in range(4):
|
for i in range(2):
|
||||||
(_, sock) = self.get(
|
(_, sock) = self.get(
|
||||||
headers={
|
headers={
|
||||||
'Host': 'localhost',
|
'Host': 'localhost',
|
||||||
'X-Delay': '2',
|
'X-Delay': '3',
|
||||||
'Connection': 'close',
|
'Connection': 'close',
|
||||||
},
|
},
|
||||||
no_recv=True,
|
no_recv=True,
|
||||||
@@ -424,7 +424,7 @@ Connection: close
|
|||||||
|
|
||||||
socks.append(sock)
|
socks.append(sock)
|
||||||
|
|
||||||
time.sleep(0.25) # required to avoid greedy request reading
|
time.sleep(1.0) # required to avoid greedy request reading
|
||||||
|
|
||||||
threads = set()
|
threads = set()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user