Skip to content

Repository files navigation

Hiatus

This gem will allow you to use Redis to pause and check for paused status of things.

Installation

Add this line to your application's Gemfile:

gem 'hiatus'

And then install with Bundler:

bundle install

Or install it globally:

gem install hiatus

Usage

Initialization / Dependency

You must have the thread-safe Redis.current set up

Extending an existing model

class YeOldeBlob
  extend Hiatus::Pausable

  def self.process_everything
    return if paused?
    ...
  end
end

rake stop_blobs do
  YeOldeBlob.pause
end

Pausing processes by name

rake read_only_maintenance_mode do
  Hiatus.pause([:blobs, :jobs, :screaming_sobs], 2000)
end
class BlobProcessor
  def process
    return if Hiatus.paused?(:blobs)
    ...
  end
end

Contributing

  1. Fork it ( http://github.com/shopkeep/hiatus/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

About

A clean interface for temporarily pausing functionality

Resources

Stars

1 star

Watchers

58 watching

Forks

Releases

Packages

Used by

Contributors

Languages