This project has been discontinued.
carrierwave-delay - asynchronous processing with CarrierWave
With carrierwave-delay you can offload version processing of your Carrierwave uploaders to Sidekiq and ActiveJob instances.
Table of Contents
carrierwave-delay works with Rails 4.0 onwards. You can add it to your
And then execute:
Or install it yourself as:
$ gem install carrierwave-delay
If you always want to be up to date fetch the latest from GitHub in your
gem 'carrierwave-delay', github: 'slooob/carrierwave-delay'
Start by including
CarrierWave::Delay in your uploader class and add
is_processing_delayed? as condition to your defined versions:
class ImageUploader < CarrierWave::Uploader::Base include CarrierWave::Delay version :small, if: :is_processing_delayed? do process resize_to_fill: [50, 50] end end
Then, define versions to be processed in your ActiveRecord class:
class Post < ApplicationRecord mount_uploader :image, ImageUploader mount_uploader :logo, LogoUploader carrierwave_delay [:image] end
By adding class methods to your model, you are able to configure queue and priority of your background tasks:
class Post < ApplicationRecord mount_uploader :image, ImageUploader mount_uploader :logo, LogoUploader carrierwave_delay [:image] def self.carrierwave_delay_queue :carrierwave # defaults to `:default` end def self.carrierwave_delay_priority 10 # defaults to `20` end end
- Leave your suggestions here
We hope that you will consider contributing to carrierwave-delay. Please read this short overview for some information about how to get started:
Give the people some
carrierwave-delay follows Semantic Versioning 2.0 as defined at http://semver.org.
Copyright (c) 2017 Slooob
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.