我是Rails的新手,所以不确定这是否是一个愚蠢的问题,但是...
我必须运行常规任务才能将数据填充到我的Rails应用程序中。今天,我使用everyth gem创建Cron条目以在系统上运行这些任务。我想将Rails应用程序迁移到Docker,以便更轻松地扩展它。我知道在Drupal(PHP)中有Poorman's Cron,它使用请求来驱动时间表。
是否可以在不使用Cron的情况下在Rails内部实现调度,或者是一种更好的管理与Rails一起正常工作的常规方法?
最佳答案
Is there a way to implement scheduling inside Rails without using Cron or a better way of managing regular tasks that works well with Rails?
Cron几乎是在* nix系统上运行预定 Activity 的工具,大多数gem实际上都是在后台利用cron的,实际上,除非您想使用第三方服务,否则避免cron可能会做很多工作。
Rails 5的新功能之一是ActiveJob:
Active Job is a framework for declaring jobs and making them run on a variety of queuing backends. These jobs can be everything from regularly scheduled clean-ups, to billing charges, to mailings. Anything that can be chopped up into small units of work and run in parallel, really.
它可以与多个后端一起使用:
关于ruby-on-rails - Rails 5没有Cron的常规任务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42005734/