我不认为你过于谨慎,但我确实认为这是一种谨慎的坏方法。如果睡眠时间计入执行时间,您不为此付费吗?它可能也计入 CPU 使用率和许多其他成本因素。此外,缓慢地关闭服务不会给您的用户任何迹象表明他们做错了什么,它只会让您的服务看起来很慢。
You'd probably be better off serving a friendly message-image letting the person know what's going on so they can modify their behavior (this is particularly good given that some people might trigger it by accident while performing completely innocent activities). If they insist on serving your message-image more than five or ten times, then it's definitely a script, so just stop answering their requests entirely.