I have configured Delayed::Paperclip to process Paperclip attachments in the background. I installed and configured Resque and according to the README, Resque should now handle background tasks:
Make sure that you have Resque up and running. The jobs will be dispatched to the :paperclip queue, so you can correctly dispatch your worker. Configure resque and your workers exactly as you would otherwise.
However, Active Job, another framework for running background tasks, is installed as a dependency for Rails 4.1/ActionMailer and it "steals" the task from Resque.
[ActiveJob] Enqueued DelayedPaperclip::Jobs::ActiveJob (Job ID: ba60f576-e544-4f53-8db2-eb0085f1f653) to Inline(paperclip) with arguments: "Photo", 79, "picture"
The problem is that Active Job seems to be running immediately in the same thread - basically it doesn't run in the background at all.
I checked out the code for Delayed::Paperclip and it seems like there's a priority to the installed backends:
def detect_background_task
return DelayedPaperclip::Jobs::ActiveJob if defined? ::ActiveJob::Base
return DelayedPaperclip::Jobs::DelayedJob if defined? ::Delayed::Job
return DelayedPaperclip::Jobs::Resque if defined? ::Resque
return DelayedPaperclip::Jobs::Sidekiq if defined? ::Sidekiq
end
When I switched them around and put Resque on top, it works. The priority seems to be hardcoded, but I figure I can't be the only one with this problem if that's the case. Is this a bug or am I missing something?