在 Ruby 中高效地在 x 秒内执行任务
在我的 Sinatra 应用程序中,我希望当用户访问特定 URL 时调用一个方法,然后在 x 秒后(不保持 HTTP 流打开),应该调用一个不同的方法。
我该怎么做?
In my Sinatra application I'd like a method to be called when a user visits a specific URL then, x seconds later (without keeping the HTTP stream open), a different method should be called.
How should I do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用 Ruby 线程:
希望有帮助!
You could use Ruby Threads:
Hope that helps!