Resque is writing to the development database even when run from a server in production mode

一个人想着一个人 提交于 2020-01-06 08:45:08

问题


When I launch my app in production to test it before rolling out to the server, I noticed that one of my database operations which is called by Resque.enqueue(worker) is performed on the WRONG database! development.sqlite3 instead of production.sqlite3. I'm running both the server and resque with zero configuration files. There must be some way to run redis or resque in the correct environment.

defaults: &defaults
host: localhost
port: 6379
development:
<<: *defaults
test:
<<: *defaults
staging:
<<: *defaults
production:
<<: *defaults

This redis config file I found may hold the key, but redis doesn't like it, saying

*** FATAL CONFIG FILE ERROR ***
 Reading the configuration file, at line 1
>>> 'defaults: &defaults'
Bad directive or wrong number of arguments

回答1:


Did you start resque worker in the production environment ? You can do it like this,

$ RAILS_ENV=production QUEUE=* rake resque:work


来源:https://stackoverflow.com/questions/12098661/resque-is-writing-to-the-development-database-even-when-run-from-a-server-in-pro

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!