ActiveRecord :: Statement对于async_exec无效

时间:2018-08-31 09:31:25

标签: ruby-on-rails sidekiq

我正在编写聊天机器人。我使用sidekiq在后台作业中运行某些方法,以便用户在处理方法时仍可以与bot对话。 在该过程的最后,我将变量返回给用户,这可以正常工作。 但是我也想将这些变量存储在我创建和迁移的表中。但是,当我在后台作业的末尾添加代码Result.create!(first_name: "Elliot", age: 26, city: "Paris")时,在Sidekiq中出现以下错误:

"error_message":"PG::ConnectionBad: PQconsumeInput() server closed the connection unexpectedly\n\tThis probably means the server terminated abnormally\n\tbefore or while processing the request.\n:

"error_class":"ActiveRecord::StatementInvalid"

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 = '"results"'::regclass

AND a.attnum > 0 AND NOT a.attisdropped

ORDER BY a.attnum

WARN: /.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/activerecord-5.1.5/lib/active_record/connection_adapters/postgresql/database_statements.rb:61:in `async_exec'

发布版本: Rails 5.1.5

Ruby版本: 红宝石2.5.1p57

非常感谢您的帮助:)

0 个答案:

没有答案