Skip to content
No description, website, or topics provided.
Ruby Shell
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin
lib
spec
.gitignore
.rspec
.travis.yml
Gemfile
LICENSE.txt
README.md
Rakefile
sidekiq_result.gemspec

README.md

Sidekiq::Result

Gem Version Code Climate Build Status Inline docs

An extension to Sidekiq message processing to track your job results.

Installation

gem install sidekiq-result

Usage

Configuration

Configure your middleware chains, lookup Middleware usage on Sidekiq wiki for more info.

require 'sidekiq'
require 'sidekiq-result'

Sidekiq.configure_server do |config|
  config.server_middleware do |chain|
    chain.add Sidekiq::Result::ServerMiddleware, expiration: 30.minutes # default
  end
end

After that you can use your jobs as usual and only include Sidekiq::Result::Worker module if you want additional functionality of passing the job's finished stateto the client.

class MyJob
  include Sidekiq::Worker
  include Sidekiq::Result::Worker

  def perform(*args)
  # your code goes here
  end
end

To overwrite expiration on worker basis and don't use global expiration for all workers write a expiration method like this below:

class MyJob
  include Sidekiq::Worker
  include Sidekiq::Result::Worker

  def expiration
    @expiration ||= 60*60*24*30 # 30 days
  end

  def perform(*args)
    # your code goes here
  end
end

But keep in mind that such thing will store details of job as long as expiration is set, so it may charm your Redis storage/memory consumption. Because Redis stores all data in RAM.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/chrismacnaughton/sidekiq_result.

License

The gem is available as open source under the terms of the MIT License.

You can’t perform that action at this time.