当我在生产环境中启动我的应用程序以在推出到服务器之前对其进行测试时,我注意到我的一个由 Resque.enqueue(worker) 调用的数据库操作是在错误的数据库上执行的! development.sqlite3 而不是 production.sqlite3。我正在使用零配置文件运行服务器和 resque。必须有一些方法可以在正确的环境中运行 redis 或 resque。
defaults: &defaults
host: localhost
port: 6379
development:
<<: *defaults
test:
<<: *defaults
staging:
<<: *defaults
production:
<<: *defaults
我找到的这个redis配置文件可能是关键,但是redis不喜欢它,说
*** FATAL CONFIG FILE ERROR ***
Reading the configuration file, at line 1
>>> 'defaults: &defaults'
Bad directive or wrong number of arguments
最佳答案
你有没有在生产环境中启动resque worker?你可以这样做,
$ RAILS_ENV=production QUEUE=* rake resque:work
关于ruby-on-rails - 即使在生产模式下从服务器运行,Resque 也在写入开发数据库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12098661/