fix over queue at resque

This commit is contained in:
Matthew K. Fu JuYuan 2012-07-03 10:51:26 +08:00
parent 1278581a82
commit 4014f8ee47
4 changed files with 9 additions and 6 deletions

View File

@ -16,6 +16,6 @@ end
# FileUtils.mv(temp_file, File.join(Rails.root, 'public/static', 'nccu_calendar.xml')) # FileUtils.mv(temp_file, File.join(Rails.root, 'public/static', 'nccu_calendar.xml'))
puts "NccuCalendar Synced4" puts "[#{ DateTime.now.strftime("%Y %D %H:%M")}]NccuCalendar Synced"
end end
end end

View File

@ -3,6 +3,7 @@ class SyncDb
@queue = :high @queue = :high
def self.perform() def self.perform()
puts "[ #{DateTime.now.strftime("%Y %D %H:%M") }]\t SyncDb Starting"
self.start_sync self.start_sync
self.set_admin self.set_admin
end end
@ -12,13 +13,13 @@ class SyncDb
args = [] args = []
%x[rake #{task} --trace >> #{Rails.root}/log/rake.log] %x[rake #{task} --trace >> #{Rails.root}/log/rake.log]
User.all.each{|ur| ur.create_dept_cache} User.all.each{|ur| ur.create_dept_cache}
puts "SyncDb Synced" puts "[#{ DateTime.now.strftime("%Y %D %H:%M")}]\tSyncDb Synced"
end end
def self.set_admin def self.set_admin
task = 'mid_site:install_admin' task = 'mid_site:install_admin'
args = [] args = []
%x[rake #{task} --trace >> #{Rails.root}/log/rake.log] %x[rake #{task} --trace >> #{Rails.root}/log/rake.log]
puts "Admin done" puts "[#{ DateTime.now.strftime("%Y %D %H:%M")}]\tAdmin done"
end end
end end

View File

@ -5,19 +5,19 @@
# description: Runs the perform method in FetchTime # description: Runs the perform method in FetchTime
nccu_daily_ldap_sync: nccu_daily_ldap_sync:
cron: * * [0,12] * * * cron: 0 0 [0,12] * * *
class: SyncDb class: SyncDb
args: args:
description: Sync NCCU middle site with Orbit for LDAP data description: Sync NCCU middle site with Orbit for LDAP data
nccu_daily_backup: nccu_daily_backup:
cron: * * 3 * * * cron: 0 0 3 * * *
class: BackupServer class: BackupServer
args: args:
description: Backup NCCU site description: Backup NCCU site
nccu_claender_sync: nccu_claender_sync:
cron: * * [0,12] * * * cron: 0 0 [0,12] * * *
class: NccuCalendar class: NccuCalendar
args: args:
description: Sync NCCU calendar RSS Feeds description: Sync NCCU calendar RSS Feeds

View File

@ -36,6 +36,7 @@ namespace :mid_site do
local_need_remove = User.all.collect{|t| t.nccu_id rescue nil}.uniq.delete_if {|x| x == nil} - remote_list local_need_remove = User.all.collect{|t| t.nccu_id rescue nil}.uniq.delete_if {|x| x == nil} - remote_list
desc "Going to delete User with IDs: #{local_need_remove.inspect}" desc "Going to delete User with IDs: #{local_need_remove.inspect}"
local_need_remove = User.excludes(nccu_ldap_uid: test_account_ldap_id ).collect{|t| t.nccu_ldap_uid rescue nil}.uniq.delete_if {|x| x == nil} - remote_list local_need_remove = User.excludes(nccu_ldap_uid: test_account_ldap_id ).collect{|t| t.nccu_ldap_uid rescue nil}.uniq.delete_if {|x| x == nil} - remote_list
AppManager.all.collect{|am| am if am.user.nil? }.delete_if {|x| x == nil}.each{|am| am.destroy}
desc "Deletion completed! \n" desc "Deletion completed! \n"
#starting update user #starting update user
@ -77,6 +78,7 @@ namespace :mid_site do
local_user.save! local_user.save!
end end
end end