I have such a simple code.
from aiohttp import web
async def hello(request):
print('Start')
for el in range(30000000):
# Any expression
1+el/10000*100000-4*234
print('Stop')
return web.Response(text="Hello, world")
app = web.Application()
app.add_routes([web.get('/', hello)])
web.run_app(app)
When I open my browser in http://0.0.0.0:8080/, I get the text "Start", and then after ~ 10 seconds I get the text "Stop". Then I open two pages http://0.0.0.0:8080/ at the same time. I expect to receive such texts within 10-11 seconds
'Start' #right now
'Start' #right now
'Stop' #in 10 sec
'Stop' #next sec
But i get (during 21 seconds)
'Start' #right now
'Stop' #in 10 sec
'Start' #at 11th sec
'Stop' #at 22th sec
What am I doing wrong?