【问题标题】:Rails2.3.8 Resque.enqueue doesn't forward the job to backgroundRails2.3.8 Resque.enqueue 不会将作业转发到后台
【发布时间】:2012-11-09 12:29:43
【问题描述】:

我正在尝试设置 Resque。我的环境中有以下内容。rb

config.gem "redis", :version =>  "3.0"
config.gem "redis-namespace", :version => "1.2.1", :lib => "redis/namespace"
config.gem "resque", :version => "1.23.0"

在开始resque-web 之前,我一直关注asciicast。在我的控制器中,我有

Resque.enqueue(SnippetHighlighter, @snippet.id)

就像在 asciiccast 中给出的例子一样。但是,我的进程没有转发到后台,而是转发到 rails 服务器。根据 asciicast 的说法,我不应该在 rails server 中出现错误,而是在 resque 中。

另外,当我启动我的 resque-web 时,我收到以下错误:

/usr/lib/ruby1.8/net/http.rb:560: in 'initialize': getaddrinfo: Name or 
service not known(SocketError)

谁能帮我解决这个问题?

【问题讨论】:

  • 你为 Resque 设置了 SnippetHighligher 类吗?
  • 我还需要做 asciicast 中指定的更多操作吗?我也设置了resque.rakeredis.yml
  • 你得到什么错误信息?
  • 我在 Rails 服务器中收到错误“ControllerName::SnippetHighlighter is undefined”,但是根据 asciicasts 的说法,我不应该在 rails 服务器中看到该错误,而是在 resque-web 中看到该错误!后台作业应该由redis服务器而不是rails服务器来处理,不是吗?
  • 你启动了你的 resque worker 了吗?

标签: ruby-on-rails resque


【解决方案1】:

您关注的 railscast 使用 rails 3.0.9resque 1.17.1

我建议您升级 rails 版本或使用与 rails 2.3.8 兼容的较低版本的 resque,因为这肯定是不兼容的问题。

【讨论】:

  • 不,它不是兼容性问题,如果是,我的 Rails 服务器将无法启动,但给我错误。当我使用resque 1.17.1 时,它有一些依赖冲突。但是,我现在已经解决了这个问题,需要在 resque.rb 文件中进行一些调整。
猜你喜欢
  • 1970-01-01
  • 2020-02-25
  • 2012-01-01
  • 2015-03-16
  • 1970-01-01
  • 1970-01-01
  • 2022-06-23
  • 1970-01-01
  • 2018-03-24
相关资源
最近更新 更多