Back

delayed_job 由于deadlock而死掉: (Mysql2::Error: Deadlock when attempting to lock a job )

发布时间: 2014-07-29 01:31:00

近期一直遇到这个问题:  delayed_job 由于deadlock而死掉: ( 报错是: Mysql2::Error: Deadlock when attempting to lock a job )  (these days I am being troubled by this problem) 

解决办法1:   (solution 1) 

使用 god 的keepalive特性来控制它。   这个方法非常丑陋,不建议使用( 它会一直占用一个进程, 100% 的CPU占用率)

解决办法2: ( solution2) 

refer to: https://github.com/collectiveidea/delayed_job_active_record/issues/63#issuecomment-25468573

# in your Gemfile: 
#gem 'delayed_job_active_record', '4.0.1'
gem 'delayed_job_active_record', git: 'https://github.com/aaronjensen/delayed_job_active_record.gi
t', branch: 'retry-deadlock-on-delete'

Back