开发者

Web2py server problem

开发者 https://www.devze.com 2023-03-13 16:14 出处:网络
I am running a web2py server which handles some requests which may take a total completion time of few seconds to few minutes. Once a connection is made to the server and it is processing a request wh

I am running a web2py server which handles some requests which may take a total completion time of few seconds to few minutes. Once a connection is made to the server and it is processing a request which takes about 2-3 minutes, new connections to the server have to wait untill the former's request is completed.

I don't know if we can tweak some parameters in web2py for this. Do we have 开发者_高级运维any way out of this problem.


web2py does not lock the server when busy with a connection but it does lock the user session, on purpose. That means other users can connect but not the one that started the original request. In the acton that takes time you can do:

session._unlock(response)

and this problem (if diagnosis is correct) will go away.

Anyway, it is not a good idea to have requests that take so long. The web server may kill your process and it is not good for usability. You should have a db table where you queue such tasks and handle them in a background process (explained in the manual) than use ajax or html5 websockets (web2y/gluon/contrib/comet_messaging.py) to check progress on the long running task.

Please bring this up on the web2py mailing list and we will help with more concrete examples.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号