如何在GAE回复中实施延迟? [英] How to implement delay in GAE replies?

查看:78
本文介绍了如何在GAE回复中实施延迟?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一旦收到来自客户端的消息,我就不想立即回复,我想等待几秒钟( random 秒).我该怎么做? (我使用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)

推荐答案

您可以使线程休眠一会儿:

You can just make the thread sleep for a while:

import thread

...

   thread.sleep(some_number_of_milliseconds)

这篇关于如何在GAE回复中实施延迟?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆