我怎样才能与乘客一起在线程中运行某些东西?

发布于 2024-09-25 05:24:10 字数 334 浏览 2 评论 0原文

我正在使用 Phusion Passenger 和 nginx 来部署 Rails/sinatra 应用程序,但目前遇到了问题。

我想运行一个类,每 30 秒检查一次向 reddit.com 提交的新内容。但由于乘客在 x 秒的空闲时间后关闭了应用程序,因此它不会继续检查。

是的,我尝试将passenger_pool_idle_time设置为0,但它仍然将其关闭。

如果您想了解更多详细信息,请参阅 github 上的应用程序

。提前致谢。

I'm using Phusion Passenger with my nginx to deploy rails/sinatra applications, and I'm currently having a problem.

I want to run a class that checks for new submissions to reddit.com every 30 seconds. But since passenger shuts down the application after x seconds of idle time, it won't keep checking.

Yes, I've tried to set passenger_pool_idle_time to 0, but it still shuts it down.

If you want more details, see the application at github

Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

一城柳絮吹成雪 2024-10-02 05:24:10

您可以使用 cron 经常调用您的服务器,以确保它仍在运行。可能发生的情况是,乘客正在启动一个初始进程,然后为稍后需要的每个工作进程分叉它。一段时间后,它会终止初始进程(认为它已经生成了它需要的所有子进程),因此将其设置为不这样做可能会修复它。

you could use cron to call into your server ever so often, to make sure it's still running. What may be happening is that passenger is starting up an initial process, then forking it for each worker process it needs later. After awhile, it kills the initial process (thinking it has spawned all the children it ever needs), so setting it to not do that might fix it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文