This gem will allow you to use Redis to pause and check for paused status of things.
Add this line to your application's Gemfile:
gem 'hiatus'
And then install with Bundler:
bundle install
Or install it globally:
gem install hiatus
You must have the thread-safe Redis.current set up
class YeOldeBlob
extend Hiatus::Pausable
def self.process_everything
return if paused?
...
end
end
rake stop_blobs do
YeOldeBlob.pause
endrake read_only_maintenance_mode do
Hiatus.pause([:blobs, :jobs, :screaming_sobs], 2000)
endclass BlobProcessor
def process
return if Hiatus.paused?(:blobs)
...
end
end- Fork it ( http://github.com/shopkeep/hiatus/fork )
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create a new Pull Request