更新时间:2022-12-26 15:47:12
backgroundrb
.但是,这会占用主 Rails 应用的内存,因为它会生成一个专用于 backgroundrb
的 Ruby 实例.SystemController
(或等效的),其中的各种操作对应于您的应用程序应执行的各种家务.您可以使用 wget
或 curl
从 crontab
中生产"它,优点是它与您的主应用程序共享资源.根据您的偏执程度或您是否容易受到 DOS(或其他类型的攻击)将此类控制器暴露给外部世界的脆弱性,您可以选择阻止从环回以外的地址访问该控制器的 URL(理想情况下,在您的反向代理中,或者来自控制器本身.)backgroundrb
. This, however, will eat up memory away from your main Rails app as it will spawn one Ruby instance exclusive to backgroundrb
.SystemController
(or equivalent) in your main application, with various actions corresponding to the various household tasks your application should perform. You can "prod" it from crontab
using wget
or curl
, the advantage being that it shares resources with your main application. Depending on how paranoid or you are, or on how vulnerable to DOS (or other types of attacks) exposing such a controller to, possibly, the outside world, you may choose to block access to this controller's URL from addresses other than the loopback (ideally in your reverse proxy, alternatively from the controller itself.)