bus/lib/tasks/update_bus_info_tasks.rake

13 lines
417 B
Ruby

desc 'Update route for bus info'
namespace :bus do
task :update_bus_info_tasks => [:environment] do
update_route_interval = RulingBusSetting.first.update_route_interval
while 1
puts ['update_bus_info_tasks',"interval: #{update_route_interval}min"]
RulingBusInfo.all.each do |bus_info|
bus_info.regenerate_cache_data
end
sleep (update_route_interval.minutes)
end
end
end