class DashboardCounter < Resque::Plugins::RestrictionJob extend OrbitApp::Module::VisitorCounterEval @queue = :high def self.perform(*args) site = Site.first obj = new(*args) site.visitor_counters[:total] = display_visitors site.visitor_counters[:today] = display_visitors_today site.visitor_counters[:this_week] = display_visitors_this_week site.visitor_counters[:this_month] = display_visitors_this_month site.visitor_counters[:this_year] = display_visitors_this_year site.save OrbitLogger.info "DashboardCounter done #{site.visitor_counters.to_s}" #Notice this is mainly used at user dashbroad. however the code there is currentlly using realtime evaluation. #and the site model will need a field call dashboard_counter to complete this job. end end