1. scheduler=Rufus::Scheduler.new
scheduler.in'120s'do
SyncProduct.first_sync_products
ActiveRecord::Base.clear_active_connections!
end
2. lib目录下task目录
statistic.rake
namespace:statisticdo
desc"每天统计差评率"
task:statistic_order_feedback_rate=>:environmentdo
StatisticOrderFeedbackRate.statistic
end
desc"每天检查是否有需要设置默认好评的订单"
task:generate_default_review=>:environmentdo
CgrReview.generate_default_review
end
end
config 下schedule.rb
every1.day,:at=>'08:00 am'do
rake"spk_interface:spk_sync_products"
end