Schedule job for tag_cloud
This commit is contained in:
parent
423e2ac54e
commit
e3d34263e3
|
@ -1,15 +0,0 @@
|
||||||
# require 'open-uri'
|
|
||||||
# require 'nokogiri'
|
|
||||||
class FetchTime < Resque::Plugins::RestrictionJob
|
|
||||||
restrict :per_300 => 10
|
|
||||||
|
|
||||||
@queue = :low
|
|
||||||
|
|
||||||
def self.perform()
|
|
||||||
# sleep 10
|
|
||||||
doc = Nokogiri::HTML(open('http://www.timeanddate.com/worldclock/city.html?n=241'))
|
|
||||||
CronMail.time_check(doc.at('#ct').children.first.text).deliver
|
|
||||||
puts "Mail Sent"
|
|
||||||
true
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
class UpdateTagCloud
|
||||||
|
@queue = :high
|
||||||
|
|
||||||
|
def self.perform()
|
||||||
|
Tag.all.each do |tag|
|
||||||
|
tag.update_attribute(:cloud_view_count, tag.impressionist_count(:created_at.gte => 14.days.ago, :created_at.lte => Time.now))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -12,6 +12,8 @@ class Tag
|
||||||
|
|
||||||
field :key
|
field :key
|
||||||
field :view_count, :type => Integer, :default => 0
|
field :view_count, :type => Integer, :default => 0
|
||||||
|
field :cloud_view_count, :type => Integer, :default => 0
|
||||||
|
|
||||||
#field :cloud_amper,:type: Integer,:default=> 0
|
#field :cloud_amper,:type: Integer,:default=> 0
|
||||||
|
|
||||||
def self.sorted_for_cloud
|
def self.sorted_for_cloud
|
||||||
|
|
|
@ -16,8 +16,8 @@ nccu_daily_backup:
|
||||||
args:
|
args:
|
||||||
description: Backup NCCU site
|
description: Backup NCCU site
|
||||||
|
|
||||||
nccu_claender_sync:
|
update_tag_cloud:
|
||||||
cron: 0 0 [0,12] * * *
|
cron: 0 0 [0,12] * * *
|
||||||
class: NccuCalendar
|
class: UpdateTagCloud
|
||||||
args:
|
args:
|
||||||
description: Sync NCCU calendar RSS Feeds
|
description: UpdateTagCloud
|
Loading…
Reference in New Issue