Git Product home page Git Product logo

mini_scheduler's Introduction

Build Status Gem Version

mini_scheduler

MiniScheduler adds recurring jobs to Sidekiq.

Installation

Add this line to your application's Gemfile:

gem 'mini_scheduler'

And then execute:

$ bundle

Or install it yourself as:

$ gem install mini_scheduler

In a Rails application, create files needed in your application to configure mini_scheduler:

bin/rails g mini_scheduler:install
rake db:migrate

An initializer is created named config/initializers/mini_scheduler.rb which lists all the configuration options.

Configuring MiniScheduler

By default each instance of MiniScheduler will run with a single worker. To amend this behavior:

if Sidekiq.server? && defined?(Rails)
  Rails.application.config.after_initialize do
    MiniScheduler.start(workers: 5)
  end
end

This is useful for cases where you have extremely long running tasks that you would prefer did not starve.

Usage

Create jobs with a recurring schedule like this:

class MyHourlyJob
  include Sidekiq::Worker
  extend MiniScheduler::Schedule

  every 1.hour

  def execute(args)
    # some tasks
  end
end

Options for schedules:

  • queue followed by a queue name, like "queue :email", default queue is "default"
  • every followed by a duration in seconds, like "every 1.hour".
  • daily at: followed by a duration since midnight, like "daily at: 12.hours", to run only once per day at a specific time.

To view the scheduled jobs, their history, and the schedule, go to sidekiq's web UI and look for the "Scheduler" tab at the top.

How to reach us

If you have questions about using mini_scheduler or found a problem, you can find us at https://meta.discourse.org.

mini_scheduler's People

Contributors

samsaffron avatar tgxworld avatar nlalonde avatar gschlager avatar udan11 avatar davidtaylorhq avatar dmke avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.