如何实现GAE回复延迟?
一旦我收到客户端的消息,我不想立即回复,我想等待几秒钟(随机秒数)。我该怎么做呢? (我使用 Channel API,所以这样的延迟对客户端来说应该没问题)
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)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你可以让线程休眠一段时间:
You can just make the thread sleep for a while:
对于 App Engine,延迟内置库的性能比睡眠更好,并且比任务队列更容易设置。
The deferred built-in library would perform better than sleep for App Engine and is easier to setup than Task Queue.