Skip to content

Commit

Permalink
Cutting gem 1.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
hlascelles committed Mar 15, 2018
1 parent 6ad4795 commit 1806dfb
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 5 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 1.0.3 (2018-03-15)

* Enforced a minimum version of `et-orbi` to supply `#to_local_time` methods. Thanks to @jish.
* Clarified config syntax

## 1.0.2 (2018-01-15)

* Added ORM adapter layer to allow use of [Sequel](https://github.com/jeremyevans/sequel)
Expand Down
15 changes: 12 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ files, but with additional features.
## Schedule configuration

The schedule file is a list of que job classes with arguments and a schedule frequency (in crontab
syntax). The format is a superset of the resque-scheduler config format, so it they can be used
as-is with no modification, assuming the job classes are migrated from Resque to Que.
syntax). The format is similar to the resque-scheduler config format, though priorities must be supplied as
integers, and job classes must be migrated from Resque to Que. Cron syntax can be anything
understood by [fugit](https://github.com/floraison/fugit#fugitcron).

It has one additional feature, `schedule_type: every_event`. This is set on a job that must be run for every
single matching cron time that goes by, even if the system is offline over more than one match. To better process these `every_event` jobs, they are always enqueued with the first
Expand Down Expand Up @@ -65,6 +66,10 @@ SendOrders:
cron: "0 0 * * *"
args: ['open']

# Use simpler cron syntax.
SendBilling:
cron: "@daily"

# Altogether now
all_args_job:
cron: "0 0 * * *"
Expand Down Expand Up @@ -125,6 +130,10 @@ then reschedules itself. The flow is as follows:
1. Some time later it runs again. It knows what jobs it should be monitoring, and notices that some have are due. It enqueues those jobs and then itself. Repeat.
1. After a deploy that changes the config, the job notices any new jobs to schedule, and knows which ones to forget. It does not need to be re-enqueued or restarted.

## Thanks
## Inspiration

This gem was inspired by the makers of the excellent [Que](https://github.com/chanks/que) job scheduler gem.

## Contributors

* @jish
2 changes: 1 addition & 1 deletion lib/que/scheduler/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Que
module Scheduler
VERSION = '1.0.2'.freeze
VERSION = '1.0.3'.freeze
end
end
11 changes: 10 additions & 1 deletion spec/que/scheduler/defined_job_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def expect_time(from, to, exp)
end
end

describe 'validations' do
describe 'field validations' do
it 'checks the cron is valid' do
expect do
described_class.new(
Expand All @@ -43,6 +43,15 @@ def expect_time(from, to, exp)
end.to raise_error(/Invalid cron 'foo 17 \* \* \*' in que-scheduler config/)
end

it 'allows crons with fugit compatible english words' do
job = described_class.new(
name: 'testing_job_definitions',
job_class: 'HalfHourlyTestJob',
cron: '@weekly'
)
expect(job.cron.to_cron_s).to eq('0 0 * * 0')
end

it 'checks the queue is a string' do
expect do
described_class.new(
Expand Down

0 comments on commit 1806dfb

Please sign in to comment.