squeaky-pl / japronto

Screaming-fast Python 3.5+ HTTP toolkit integrated with pipelining HTTP server based on uvloop and picohttpparser.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Japronto getting blocked/hanged

spawn08 opened this issue · comments

Hey guys I have three end points "/", "/train", and "/classify". When im specifying the worker > 1,in my case it is 4 (app.run(host...,port...,worker=4)). My "/" route is working fine but as soon as I go to route "/train" and "/classify", japronto is getting blocked/hanged. im not getting any response from the server and postman just keep "loading.."

async def train(request):
train_network_sanic.train()
return request.Response(text="training successfull")

async def classify(request):
sentence = request.query.get('query')
return_list = train_network_sanic.classify(sentence)
return request.Response(text=str(return_list))

app = Application()
app.router.add_route('/', hello)
app.router.add_route('/api/train',train)
app.router.add_route('/api/classify',classify)
app.run(host='0.0.0.0', port=8000,debug=True,worker_num=4)

This is what my code looks like for route "/train" and "/classify". can anybody help?

Just at first sight, async coroutines are not supposed to yield instead of returning?

im not using yield anywhere in the code?