Overriding preform in Carrierwave Backgrounder gem
Carrierwave Backgrounder is a gem that makes it easier to process assets in background. Resizing and optimization can be done on Sidekiq rather than in the main thread. Very useful.
It’s possible to override the default worker, the instructions to which are here.
I needed it to do some other things at the same time, so I went around digging in the source to see how it actually works.
This does the actual work. It functions the same way as the normal processor – by toggling a flag that’s then picked up by the processer.
It includes this for some set up.
So, a custom worker that does both (and more) looks like this: