cerebris / delayed_mailhopper

A delivery agent for Mailhopper that uses DelayedJob to queue and deliver email.
MIT License
28 stars 5 forks source link

Possibly Ruby 2.1.5 issue with `Delayed::Job.enqueue(SendJob.new(1))`? #9

Open jpegjames opened 9 years ago

jpegjames commented 9 years ago

After upgrading to Ruby 2.1.5 from Ruby 2.1.2, sending emails with delayed_mailhopper creates this error:

ArgumentError: wrong number of arguments (1 for 0)

…ailhopper-0.0.7/app/models/delayed_mailhopper/email.rb:   9:in `initialize'
…ailhopper-0.0.7/app/models/delayed_mailhopper/email.rb:   9:in `new'
…ailhopper-0.0.7/app/models/delayed_mailhopper/email.rb:   9:in `enqueue'
…0/gems/mailhopper-0.3.0/app/models/mailhopper/email.rb:  25:in `create_from_mail'
…by/2.1.0/gems/mailhopper-0.3.0/lib/mailhopper/queue.rb:   7:in `deliver!'
…/bundle/ruby/2.1.0/gems/mail-2.5.4/lib/mail/message.rb:2129:in `do_delivery'
…/bundle/ruby/2.1.0/gems/mail-2.5.4/lib/mail/message.rb: 232:in `block in deliver'
…/bundle/ruby/2.1.0/gems/mail-2.5.4/lib/mail/message.rb: 232:in `deliver'
…ms/delayed_job-4.0.0/lib/delayed/performable_mailer.rb:   6:in `perform'
…1.0/gems/delayed_job-4.0.0/lib/delayed/backend/base.rb: 105:in `block in invoke_job'
…/2.1.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb:  60:in `call'
…/2.1.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb:  60:in `block in initialize'
…/2.1.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb:  65:in `call'
…/2.1.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb:  65:in `execute'
…/2.1.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb:  38:in `run_callbacks'
…1.0/gems/delayed_job-4.0.0/lib/delayed/backend/base.rb: 102:in `invoke_job'
…uby/2.1.0/gems/delayed_job-4.0.0/lib/delayed/worker.rb: 206:in `block (2 levels) in run'
                   /usr/local/lib/ruby/2.1.0/timeout.rb:  91:in `block in timeout'
                   /usr/local/lib/ruby/2.1.0/timeout.rb: 101:in `call'
                   /usr/local/lib/ruby/2.1.0/timeout.rb: 101:in `timeout'
…uby/2.1.0/gems/delayed_job-4.0.0/lib/delayed/worker.rb: 206:in `block in run'
…uby/2.1.0/gems/delayed_job-4.0.0/lib/delayed/worker.rb: 205:in `run'
…uby/2.1.0/gems/delayed_job-4.0.0/lib/delayed/worker.rb: 267:in `block in reserve_and_run_one_job'
…/2.1.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb:  60:in `call'
…/2.1.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb:  60:in `block in initialize'
…/2.1.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb:  65:in `call'
…/2.1.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb:  65:in `execute'
…/2.1.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb:  38:in `run_callbacks'
…uby/2.1.0/gems/delayed_job-4.0.0/lib/delayed/worker.rb: 267:in `reserve_and_run_one_job'
…uby/2.1.0/gems/delayed_job-4.0.0/lib/delayed/worker.rb: 189:in `block in work_off'
…uby/2.1.0/gems/delayed_job-4.0.0/lib/delayed/worker.rb: 188:in `times'
…uby/2.1.0/gems/delayed_job-4.0.0/lib/delayed/worker.rb: 188:in `work_off'
…uby/2.1.0/gems/delayed_job-4.0.0/lib/delayed/worker.rb: 153:in `block (4 levels) in start'
…uby/2.1.0/gems/delayed_job-4.0.0/lib/delayed/worker.rb: 152:in `block (3 levels) in start'
…/2.1.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb:  60:in `call'
…/2.1.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb:  60:in `block in initialize'
…/2.1.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb:  65:in `call'
…/2.1.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb:  65:in `execute'
…/2.1.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb:  38:in `run_callbacks'
…uby/2.1.0/gems/delayed_job-4.0.0/lib/delayed/worker.rb: 151:in `block (2 levels) in start'
…uby/2.1.0/gems/delayed_job-4.0.0/lib/delayed/worker.rb: 150:in `loop'
…uby/2.1.0/gems/delayed_job-4.0.0/lib/delayed/worker.rb: 150:in `block in start'
…s/delayed_job-4.0.0/lib/delayed/plugins/clear_locks.rb:   7:in `call'
…s/delayed_job-4.0.0/lib/delayed/plugins/clear_locks.rb:   7:in `block (2 levels) in <class:ClearLocks>'
…/2.1.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb:  78:in `call'
…/2.1.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb:  78:in `block (2 levels) in add'
…/2.1.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb:  60:in `call'
…/2.1.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb:  60:in `block in initialize'
…/2.1.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb:  78:in `call'
…/2.1.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb:  78:in `block in add'
…/2.1.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb:  65:in `call'
…/2.1.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb:  65:in `execute'
…/2.1.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb:  38:in `run_callbacks'
…uby/2.1.0/gems/delayed_job-4.0.0/lib/delayed/worker.rb: 149:in `start'
…ruby/2.1.0/gems/delayed_job-4.0.0/lib/delayed/tasks.rb:   9:in `block (2 levels) in <top (required)>'
…ed/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/task.rb: 240:in `call'
…ed/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/task.rb: 240:in `block in execute'
…ed/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/task.rb: 235:in `each'
…ed/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/task.rb: 235:in `execute'
…ed/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/task.rb: 179:in `block in invoke_with_call_chain'
                   /usr/local/lib/ruby/2.1.0/monitor.rb: 211:in `mon_synchronize'
…ed/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/task.rb: 172:in `invoke_with_call_chain'
…ed/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/task.rb: 165:in `invoke'
…le/ruby/2.1.0/gems/rake-10.3.2/lib/rake/application.rb: 150:in `invoke_task'
…le/ruby/2.1.0/gems/rake-10.3.2/lib/rake/application.rb: 106:in `block (2 levels) in top_level'
…le/ruby/2.1.0/gems/rake-10.3.2/lib/rake/application.rb: 106:in `each'
…le/ruby/2.1.0/gems/rake-10.3.2/lib/rake/application.rb: 106:in `block in top_level'
…le/ruby/2.1.0/gems/rake-10.3.2/lib/rake/application.rb: 115:in `run_with_threads'
…le/ruby/2.1.0/gems/rake-10.3.2/lib/rake/application.rb: 100:in `top_level'
…le/ruby/2.1.0/gems/rake-10.3.2/lib/rake/application.rb:  78:in `block in run'
…le/ruby/2.1.0/gems/rake-10.3.2/lib/rake/application.rb: 176:in `standard_exception_handling'
…le/ruby/2.1.0/gems/rake-10.3.2/lib/rake/application.rb:  75:in `run'

I've narrowed it down to this line of code Delayed::Job.enqueue(SendJob.new(self.id)) (view code) and I've tried just pasting Delayed::Job.enqueue(SendJob.new(1)) and SendJob.new(1) into rails console, and I get the same errors:

ArgumentError: wrong number of arguments (1 for 0)
    from (irb):14:in `initialize'
    from (irb):14:in `new'
    from (irb):14
    from /var/.../web_head/shared/bundle/ruby/2.1.0/gems/railties-3.2.21/lib/rails/commands/console.rb:47:in `start'
    from /var/.../web_head/shared/bundle/ruby/2.1.0/gems/railties-3.2.21/lib/rails/commands/console.rb:8:in `start'
    from /var/.../web_head/shared/bundle/ruby/2.1.0/gems/railties-3.2.21/lib/rails/commands.rb:41:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'

I'm running Rails 2.3.21 for both Ruby environments. It still works in the older Ruby 2.1.2 environment. Any thoughts?

lebrauncom commented 3 years ago

@jpegjames after 6 years, I finally fixed this: https://github.com/venture360/delayed_mailhopper/commit/3d500e57c2f85f13a514054af90fffba16c6f0b3