延迟的作业未执行队列

时间:2018-06-23 23:35:52

标签: ruby-on-rails postgresql delayed-job

跟踪在v5.2上运行的应用。使用puma服务器和postgres DB。延迟的作业未运行作业队列。在DJ服务上启动时,出现以下错误消息,DJ终止,但rake job:work命令正在运行作业,没有任何问题。

RAILS_ENV=development bin/delayed_job start

返回错误消息为

E, [2018-06-23T15:43:34.630732 #4316] ERROR -- : 2018-06-23T15:43:34-0700: [Worker(delayed_job host:WA021Z7GTFM pid:4316)] Job UploadSpeechJob (id=2066014) FAILED (0 prior attempts) with ActiveRecord::StatementInvalid: PG::ConnectionBad: PQconsumeInput() server closed the connection unexpectedly
    This probably means the server terminated abnormally
    before or while processing the request.
:               SELECT a.attname, format_type(a.atttypid, a.atttypmod),
                     pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod,
                     c.collname, col_description(a.attrelid, a.attnum) AS comment
                FROM pg_attribute a
                LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum
                LEFT JOIN pg_type t ON a.atttypid = t.oid
                LEFT JOIN pg_collation c ON a.attcollation = c.oid AND a.attcollation <> t.typcollation
               WHERE a.attrelid = '"asset_files"'::regclass
                 AND a.attnum > 0 AND NOT a.attisdropped
               ORDER BY a.attnum

此问题在所有环境中仍然存在。我曾尝试重新启动DJ,但没有运气。 作为解决方法,我正在使用此命令。

RAILS_ENV=development rake jobs:work

应用程序最近从4.2迁移到5.2。延迟作业是否支持rails v5.2。有人能指出我正确的方向吗?

1 个答案:

答案 0 :(得分:0)

从Rails 5.1.6升级到5.2.4.1导轨后,我遇到了类似的情况。在5.1.6中,拥有

config.active_job.queue_adapter = :delayed_job

在我的config / application.rb文件中,而在任何特定于环境的文件中都不需要它。

我放了一个百灵鸟

config.active_job.queue_adapter = :delayed_job

进入我的 config / environments / development.rb 文件,然后突然开始执行作业。