How to implement delay in GAE replies?

陌路散爱 提交于 2019-12-12 10:19:28

问题


Once I've got a message from the client, I don't want to reply immediately, I want to wait for a few seconds (random number of seconds). How can I do it? (I use Channel API, so such delay should be OK for the client)


回答1:


You can just make the thread sleep for a while:

import thread

...

   thread.sleep(some_number_of_milliseconds)



回答2:


The deferred built-in library would perform better than sleep for App Engine and is easier to setup than Task Queue.

[https://cloud.google.com/appengine/articles/deferred][1]


来源:https://stackoverflow.com/questions/9420223/how-to-implement-delay-in-gae-replies

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!