MCPcopy
hub / github.com/aio-libs/aiohttp / do_bomb

Function do_bomb

benchmark/async.py:183–201  ·  view source on GitHub ↗
(in_iter)

Source from the content-addressed store, hash-verified

181
182 @asyncio.coroutine
183 def do_bomb(in_iter):
184 nonlocal processed_count
185 for rnd in in_iter:
186 real_url = url + '/test/' + rnd
187 try:
188 t1 = loop.time()
189 resp = yield from client.get(real_url)
190 assert resp.status == 200, resp.status
191 if 'text/plain; charset=utf-8' != resp.headers['Content-Type']:
192 raise AssertionError('Invalid Content-Type: %r' %
193 resp.headers)
194 body = yield from resp.text()
195 yield from resp.release()
196 assert body == ('Hello, ' + rnd), rnd
197 t2 = loop.time()
198 out_times.append(t2 - t1)
199 processed_count += 1
200 except Exception:
201 continue
202
203 in_iter = gen()
204 bombers = []

Callers 1

attackFunction · 0.85

Calls 4

appendMethod · 0.80
getMethod · 0.45
textMethod · 0.45
releaseMethod · 0.45

Tested by

no test coverage detected