0.0
Repository is archived
No commit activity in last 3 years
No release in over 3 years
An extension to sidekiq to retrieve the job result
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.10
>= 0
~> 10.0
>= 0

Runtime

>= 2.7
 Project Readme

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.