本文介绍了无法找出Delayed :: DeserializationError的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Rails 3.2.12运行delay_job 3.0.5(delayed_job_active_record 0.4.1)。我因反序列化而遇到一些工作失败的问题。这是一个失败处理程序之一的非常简单的示例:

I am running delayed_job 3.0.5 (delayed_job_active_record 0.4.1) with Rails 3.2.12. I am having problems with some of my jobs failing because of "Deserialization". Here is a really simple example of one of the failing handlers:

--- !ruby/struct:Delayed::PerformableMethod
object: LOAD;Project;924951
method: :send_project_open_close_without_delay
args: []

当我尝试调用此作业时:

When I try to invoke this job:

Delayed::DeserializationError: Job failed to load: undefined method `members' for nil:NilClass.

每个人似乎都认为这是由不再存在的AR对象引起的。就我而言,我可以很好地运行处理程序:

Everyone seems to think this is caused by an AR object that no longer exists. In my case, I can run the handler just fine:

Project.find(924951).send_open_close_without_delay

还有什么可能导致错误?

What else could be causing the error?

推荐答案

以防万一有人遇到此问题。我发现原因是某些作业被注入了较旧版本的延迟作业。因此,当较新的延迟作业尝试处理它们时,它无法反序列化处理程序。

Just in case anyone ever runs into this issue. I figured out the cause was some of the jobs were injected with an older version of Delayed Job. So when the newer Delayed Job attempted to process them, it was unable to deserialize the handler.

这篇关于无法找出Delayed :: DeserializationError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-23 20:03