Skip to content

Commit

Permalink
change to use :repeated rake task instead of :cron task
Browse files Browse the repository at this point in the history
  • Loading branch information
mjankowski committed Jan 23, 2011
1 parent 3b35010 commit 6714377
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
21 changes: 18 additions & 3 deletions README.markdown
@@ -1,13 +1,28 @@
Repeated::Job
=============

Repeated::Job will use Delayed::Job to call `rake cron` on your app at an
interval you specify.
Repeated::Job was written by David Dollar, original here - https://github.com/ddollar/repeated_job

Changes
=======

In this fork, these are the interesting changes:

* Changed scheduling to round to nearest interval. So, tasks that run every 5 minutes will actually run on the :00's and :05's - instead of 5 mins from whenever your app server happens to have started.
* Changed the rake task that gets run to 'repeated' instead of 'cron' - I want to preserve the ability to run 'cron' on heroku platform unrelated to these repeated jobs.
* Updated code to avoid some Delayed::Job warnings.

Overview
========

Repeated::Job will use Delayed::Job to call `rake repeated` on your app at an interval you specify.

Internally, it's just constantly scheduling Delayed Jobs to call itself, and then does nothing but call your rake tasks and schedule itself again.

Installation
============

script/plugin install git://github.com/ddollar/repeated_job.git
script/plugin install git://github.com/mjankowski/repeated_job.git

Setup
=====
Expand Down
2 changes: 1 addition & 1 deletion lib/repeated_job.rb
Expand Up @@ -13,7 +13,7 @@ def initialize

def perform
schedule_next
Rake::Task["cron"].execute
Rake::Task["repeated"].execute
end

def schedule_next
Expand Down
2 changes: 1 addition & 1 deletion spec/repeated_job_spec.rb
Expand Up @@ -48,7 +48,7 @@

it "should schedule itself again when executing" do
@was_run = false
task(:cron) { @was_run = true }
task(:repeated) { @was_run = true }

@repeated.should_receive(:schedule_next)
@repeated.perform
Expand Down

0 comments on commit 6714377

Please sign in to comment.