gpt4 book ai didi

ruby-on-rails - 即使在生产模式下从服务器运行,Resque 也在写入开发数据库

转载 作者:可可西里 更新时间:2023-11-01 11:05:17 27 4
gpt4 key购买 nike

当我在生产环境中启动我的应用程序以在推出到服务器之前对其进行测试时,我注意到我的一个由 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/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com