0.0
No commit activity in last 3 years
No release in over 3 years
Small background job scheduler closely related with Rails ActiveJob and PostgreSQL.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

~> 2.0
~> 5.0
~> 13.0, >= 13.0.3
 Project Readme

MidgetJobs

MidgetJobs is simple implementation of background jobs for Ruby on Rails. I does not meant to be used without it. It is connected to ActiveJob and PostgreSQL using its triggers, notifications and listening.

Update from 0.1.7 to 0.2.0

There is new column runner in midget_jobs table! It is used to recognise who will run particular job (if there are multiple application over one database)

I added new configuration to Initializer. Add this to your config/initializers/midget_jobs.rb Rails.application.config.x.midget_jobs.runner = Rails.application.class.parent_name

Please create migration with generator rails generate migration AddRunnerToMidgetJob runner:string:index

Installation

Add this line to your application's Gemfile:

gem 'midget_jobs'

And then execute:

$ bundle

Then run

$ rails generate midget_jobs:install

This generator creates an initializer file at config/initializers and migrations to db/migrate

With Puma's multiple workers on production

In file config/initializers/midget_jobs.rb disable start with puma:

...
if Rails.const_defined?('Server')# || $0.include?('puma')

In file config/puma/production.rb update on_worker_boot do block as:

...
on_worker_boot do
  ActiveRecord::Base.establish_connection if defined?(ActiveRecord)
  Rails.logger.debug 'on_worker_boot starting jobs'

  MidgetJobs.initialize_workers
  ...
end

Usage

Just use ActiveJob as described in Guides

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake test to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/jchsoft/midget_jobs. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

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

Code of Conduct

Everyone interacting in the MidgetJob project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.