Delated_job (or DJ) encapsulates the common pattern of asynchronously executing longer tasks in the background. It is a direct extraction from Shopify where the job table is responsible for a multitude of core tasks. Augmented by Keith to allows for callbacks on idle.
Gemfile gem 'keithmgould-delayed_job', '~> 1.7.1'
install gem install keithmgould-delayed_job