亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区
Chinaunix
標(biāo)題:
使用eventlet的wsgi可以實(shí)現(xiàn)并發(fā)處理請求嗎
[打印本頁]
作者:
love5783
時(shí)間:
2015-10-27 15:31
標(biāo)題:
使用eventlet的wsgi可以實(shí)現(xiàn)并發(fā)處理請求嗎
本人python小白,最近在用eventlet 中的wsgi實(shí)現(xiàn)http restful接口。測試時(shí)發(fā)現(xiàn)如果一個(gè)請求阻塞了,所以請求都會等待。
請問是否可以實(shí)現(xiàn)并行處理請求,或者有沒有好的框架推薦?
目的和要求如下:
1.想實(shí)現(xiàn)一個(gè)http server,提供restful調(diào)用接口。
2.提供的接口是同步的。
3.如何實(shí)現(xiàn)并行處理請求?
我自己是如下實(shí)現(xiàn)的,不對,哪位大俠幫忙改正一下。
def handler(env, start_response):
try :
request = requestUtil.Request(env)
returnv = pool.spawn(myHandler, request)
print returnv
except Exception :
log.error("Dispatcher Exception.")
print "Dispatcher Exception."
start_response('200 OK', [('Content-Type', 'text/plain')])
return [returnv]
if __name__ == "__main__" :
pool = eventlet.GreenPool()
port = 8023
wsgi.server(eventlet.listen(('', port)), handler)
復(fù)制代碼
上面的實(shí)現(xiàn)雖然處理了請求,但是并沒有給調(diào)用者返回。高手幫幫忙
作者:
love5783
時(shí)間:
2015-10-27 15:32
回復(fù)
1#
love5783
而且后臺報(bào)錯(cuò):
<eventlet.greenthread.GreenThread object at 0x7fdf573af910>
Traceback (most recent call last):
File "/usr/lib/python2.6/site-packages/eventlet-0.12.1-py2.6.egg/eventlet/wsgi.py", line 390, in handle_one_response
headers_set[1].append(('Content-Length', str(sum(map(len, result)))))
TypeError: object of type 'GreenThread' has no len()
復(fù)制代碼
作者:
love5783
時(shí)間:
2015-10-27 17:33
CU的大神呢,來幫幫忙。!
歡迎光臨 Chinaunix (http://72891.cn/)
Powered by Discuz! X3.2