How to resolve deserialization error in delayed job?

前端 未结 7 1963
遇见更好的自我
遇见更好的自我 2021-02-06 22:38

I am trying to use DelayedJob and the job is failing, giving the following error in the database:

{Delayed::DeserializationError
/Library/Ruby/Gems/1.8/gems/delayed_j         


        
相关标签:
7条回答
  • 2021-02-06 23:25

    There's also a documented bug with DJ when the params passed into the handler field in the DB are longer than a standard TEXT column:

    https://github.com/collectiveidea/delayed_job/issues/491

    If this happens to be your problem, changing the column to a MEDIUMINT should fix the issue.

    I did this in a migration like so:

    change_column :delayed_jobs, :handler, :text, :limit => 16777215
    ActiveRecord::Base.connection.execute("DELETE FROM delayed_jobs WHERE LENGTH(handler) >= 65535")
    

    You can check to see if it's an issue with a simple DB query:

    SELECT * FROM delayed_jobs WHERE LENGTH(handler) >= 65535
    
    0 讨论(0)
提交回复
热议问题