Created
November 14, 2011 21:09
-
-
Save captproton/1365176 to your computer and use it in GitHub Desktop.
run workers on time
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'clockwork' | |
| include Clockwork | |
| # Ruby 1.9.2 does not add the current directory in the LOAD_PATH, so we need to be more direct | |
| require File.expand_path('../config/boot', __FILE__) #instead of: require 'config/boot' | |
| require File.expand_path('../config/environment', __FILE__) # instead of: require 'config/environment' | |
| handler do |job| | |
| puts "Running #{job}" | |
| end | |
| # testing to see if clock is working | |
| every(15.seconds, 'greeting.job') { puts "hi there!" } | |
| # cues up delayed_job of caching techmeme.com headlines, to be executed as soon as not busy. | |
| every(15.seconds, 'techmeme.refresh') { Headline.delay.for_yesterday_and_today_and_top_feed } | |
| every(30.seconds, 'markepoint_quote_collection.refresh') { MarketPoint.delay.update_quotes } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment