Project

dalliance

0.01
Low commit activity in last 3 years
No release in over a year
Background processing for ActiveRecord using a 'delayable' worker and a state_machine
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

>= 5.2, < 6.2
>= 0
 Project Readme

dalliance¶ ↑

Background processing for ActiveRecord w/ a ‘delayable’ worker & a state_machine

Built in support for delayed_job or resque.

Getting Started¶ ↑

In your Gemfile:

gem "dalliance"

In your model:

class Model < ActiveRecord::Base
  dalliance :process_method
end

process_method is the name of the method to invoke for background processing to kick it off just call dalliance_background_process

Models can also be re-processed to allow front-end users to reprocess without needing to loop in PMs or developers:

class Model < ActiveRecord::Base
  dalliance :process_method,
            reprocess_method: :reprocessing_method
end

Keep in mind that a record that has not already been completely processed (eg in a state of ‘pending’ or ‘processing’) cannot be reprocessed. Attempting to reprocess the record will raise an error.

Handle your migrations:¶ ↑

rails g dalliance:progress_meter

rails g dalliance:update model_name

ProgressMeter¶ ↑

Create a method called dalliance_progress_meter_total_count (or provide the dalliance_progress_meter_total_count_method option)

Inside process_method call dalliance_progress_meter.increment! after each iteration

In your views you can then call dalliance_progress to get feedback on your asynchronous process

Copyright © 2012 Annkissam. See LICENSE for details.