README.md in ruby-clock-1.0.0 vs README.md in ruby-clock-2.0.0.beta1
- old
+ new
@@ -2,10 +2,14 @@
ruby-clock is a [job scheduler](https://en.wikipedia.org/wiki/Job_scheduler),
known by heroku as a [clock process](https://devcenter.heroku.com/articles/scheduled-jobs-custom-clock-processes).
In many cases it can replace the use of cron.
+Why another ruby scheduler project? See
+[this feature matrix of the space](https://docs.google.com/spreadsheets/d/148VMKY9iyOyUASYytSGiUJKvH0-O5Ri-3Cwr3S6DRPU/edit?usp=sharing).
+Feel free to leave a comment with suggestions for changes or additions.
+
This gem is very small with very few lines of code. For all its scheduling capabilities,
it relies on the venerable [rufus-scheduler](https://github.com/jmettraux/rufus-scheduler/).
rufus-scheduler
[does not aim to be a standalone process or a cron replacement](https://github.com/jmettraux/rufus-scheduler/issues/307),
ruby-clock does.
@@ -61,25 +65,22 @@
bundle exec clock clocks/MyClockfile
### Rails
-Install the `clock` binstub and commit to your repo.
-
- bundle binstubs ruby-clock
-
To run your clock process in your app's environment:
- bundle exec rails runner bin/clock
+ bundle exec clock
To get smarter database connection management (such as in the case of a database restart or upgrade,
and maybe other benefits) and code reloading in dev (app code, not the code in Clockfile itself),
jobs are automatically wrapped in the
[rails app reloader](https://guides.rubyonrails.org/threading_and_code_execution.html).
This [may incur a performance impact for certain jobs](https://github.com/rails/rails/issues/43504),
I'm still exploring this.
+
#### ActiveRecord Query Cache
You may wish to
[turn off the ActiveRecord Query Cache](https://code.jjb.cc/turning-off-activerecord-query-cache-to-improve-memory-consumption-in-background-jobs)
for your jobs. You can do so with the around trigger:
@@ -105,22 +106,22 @@
### Heroku and other PaaS's
Add this line to your Procfile
```
-clock: bundle exec rails runner bin/clock
+clock: bundle exec clock
```
You might have a main clock for general scheduled jobs, and then standalone ones
if your system has something where you want to monitor and adjust resources
for that work more precisely. Here, maybe the main clock needs a 2GB instance,
and the others each need 1GB all to themselves:
```
-clock: bundle exec rails runner bin/clock
-thing_checker: bundle exec rails runner bin/clock clocks/thing_checker.rb
-thing_reporter: bundle exec rails runner bin/clock clocks/thing_reporter.rb
+clock: bundle exec clock
+thing_checker: bundle exec clock clocks/thing_checker.rb
+thing_reporter: bundle exec clock clocks/thing_reporter.rb
```
Because of this feature, do I regret using "Clockfile" instead of, say, "clock.rb"? Maybe.
#### Observing logs
@@ -189,11 +190,11 @@
Until this is figured out, if you are concerned about jobs exiting inelegantly,
you may want to run your shell jobs in their own separate clock process.
```
-bundle exec rails runner bin/clock clocks/main_jobs.rb
-bundle exec rails runner bin/clock clocks/shell_jobs.rb
+bundle exec clock clocks/main_jobs.rb
+bundle exec clock clocks/shell_jobs.rb
```
### Rake tasks