defer view creation on so updates are not performed when people navigate to topics

This commit is contained in:
Sam
2013-10-04 17:00:23 +10:00
parent 5bf26ec34e
commit e18b93026a
6 changed files with 49 additions and 20 deletions

View File

@@ -0,0 +1,17 @@
module Jobs
# Asynchronously send an email to a user
class ViewTracker < Jobs::Base
def execute(args)
topic_id = args[:topic_id]
user_id = args[:user_id]
ip = args[:ip]
track_visit = args[:track_visit]
View.create_for_parent(Topic, topic_id, ip, user_id)
if track_visit
TopicUser.track_visit! topic_id, user_id
end
end
end
end