Skip to content

Instantly share code, notes, and snippets.

@pobing
Created October 22, 2014 03:05
Show Gist options
  • Save pobing/48b37dcd69e408036b1f to your computer and use it in GitHub Desktop.
Save pobing/48b37dcd69e408036b1f to your computer and use it in GitHub Desktop.
clockwork use demo
#encoding: utf-8
# https://github.com/tomykaira/clockwork
# Usage:
# clockwork workers/clock_worker.rb & or
# clockworkd -c workers/clock_worker.rb run
require 'clockwork'
require File.expand_path('../../config/boot', __FILE__)
ENV['RACK_ENV'] = 'test'
module Clockwork
configure do |config|
config[:sleep_timeout] = 5
config[:logger] = Logging.logger(:clockwork)
config[:tz] = 'EST'
config[:max_threads] = 15
config[:thread] = true
end
#panel export
every(1.week, 'panel_export.job', :at => 'Sunday 3:00') { `rake panel_export` }
#ipsos
every(1.day, 'ipsos:sync.job', :at => '1:00') { `rake ipsos:sync` }
every(1.day, 'ipsos:sync.job', :at => '2:00') { `rake ipsos:import` }
#paid collector
every(5.minutes, 'paid_online') { `rake paid_online` }
every(5.minutes, 'paid_offline') { `rake paid_offline` }
every(10.seconds, 'frequent.job') { `rake collector:noraml_offline` }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment