在轨道中生成

发布于 2024-08-20 00:12:40 字数 288 浏览 1 评论 0 原文

我正在使用spawn插件(http://rubyforge.org/projects/spawn/)工作得很好。然而,我后来转移到 Mongo (使用 mongo_mapper)并且 Spawn 不再工作。

修改插件超出了我的能力范围。有没有一种简单的方法可以在 Rails 中与 Mongo 一起使用?这不是一个经常运行的过程,因此它不一定是世界上最优雅的解决方案。

谢谢!

I was using the spawn plugin (http://rubyforge.org/projects/spawn/) which worked excellent. However, I then moved to Mongo (using mongo_mapper) and Spawn no longer worked.

Modifying the plugin is beyond the scope of my abilities. Is there a simple way to do spawning in Rails that would work with Mongo? It's not an often-run process so it doesn't have to be the most elegant solution in the world.

Thanks!

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

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

发布评论

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

评论(2

你的他你的她 2024-08-27 00:12:40

看起来它不起作用的原因是因为:

该插件还修补 ActiveRecord::Base 以处理使用时的一些已知错误
线程(参见 lib/patches.rb)。

是否可以将 cron 作业与 script/runner 一起使用?如果是这样,以下链接应该可以帮助您:

http://www.ameravant.com/posts/recurring-tasks-in-ruby-on-rails-using-runner-and-cron-jobs

It looks like the reason it's not working is because:

The plugin also patches ActiveRecord::Base to handle some known bugs when using
threads (see lib/patches.rb).

Is there anyway you could use a cron job with script/runner? If so the following link should help you:

http://www.ameravant.com/posts/recurring-tasks-in-ruby-on-rails-using-runner-and-cron-jobs

长伴 2024-08-27 00:12:40

我非常喜欢将逻辑放入控制器中,并使用 cron 通过curl 或 wget 调用页面。

简单、便宜,可以在 Rails 堆栈中工作,因此您可以重复使用您的代码。

I am a big fan of putting the logic into a controller and using cron to call the page with curl or wget.

Easy, cheap, works within the Rails stack so you can re-use your code.

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