squeaky-pl / japronto

Screaming-fast Python 3.5+ HTTP toolkit integrated with pipelining HTTP server based on uvloop and picohttpparser.
MIT License
8.61k stars 581 forks source link

Japronto getting blocked/hanged #124

Open spawn08 opened 6 years ago

spawn08 commented 6 years ago

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?

Mec-iS commented 6 years ago

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

spawn08 commented 6 years ago

im not using yield anywhere in the code?

spawn08 commented 6 years ago

@squeaky-pl any help??