ActiveJob expecting 1 argument given 3
Closed this issue · 1 comments
elithecho commented
I have active job setup according to README as so and having Sidekiq running in the background but the job throws an error with receiving more arguments as expected.
class AttachmentJob < ActiveJob::Base
include ::CarrierWave::Workers::ProcessAssetMixin
queue_as :default
after_perform do
# your code here
end
# Sometimes job gets performed before the file is uploaded and ready.
# You can define how to handle that case by overriding `when_not_ready` method
# (by default it does nothing)
def when_not_ready
retry_job
end
end
Attachment class
class Attachment < ActiveRecord::Base
mount_uploader :attachment_file, AttachmentUploader
process_in_background :attachment_file, AttachmentJob
end
console
ActiveJob] Enqueued AttachmentJob (Job ID: 42cbc497-9a6f-4a96-87d3-a90bdd071656) to Sidekiq(default) with arguments: "Attachment", "550065", "attachment_file"
Error throwing wrong number of argument given 3 expected 1
2017-03-20T06:23:07.410Z 74448 TID-oxfr89c70 WARN: {"class":"ActiveJob::QueueAdapters::SidekiqAdapter::JobWrapper","wrapped":"AttachmentJob","queue":"default","args":[{"job_class":"AttachmentJob","job_id":"42cbc497-9a6f-4a96-87d3-a90bdd071656","queue_name":"default","arguments":["Attachment","550065","attachment_file"],"locale":"en"}],"retry":true,"jid":"40fee8d85665a66d4ea838e4","created_at":1489990937.664505,"enqueued_at":1489990987.3856,"error_message":"wrong number of arguments (given 3, expected 1)","error_class":"ArgumentError","failed_at":1489990937.680864,"retry_count":2,"retried_at":1489990987.4095712}
2017-03-20T06:23:07.410Z 74448 TID-oxfr89c70 WARN: ArgumentError: wrong number of arguments (given 3, expected 1)
2017-03-20T06:23:07.410Z 74448 TID-oxfr89c70 WARN: /Users/chong/Workspace/work/bluethumb/app/jobs/attachment_job.rb:4:in `perform'
Points to note
Rails Version: 4.2.6
Anything I'm doing wrong here?
lardawge commented
No issue that I can see. Working towards 1.0 and am explicitly adding active_job support. I will be testing against a rails app specifically. You can follow along in the 1.0-beta branch.
Sorry for the massively late reply 😊