moves storing of visits to queue
This commit is contained in:
6
app/jobs/stats_job.rb
Normal file
6
app/jobs/stats_job.rb
Normal file
@@ -0,0 +1,6 @@
|
||||
class StatsJob < ActiveJob::Base
|
||||
queue_as :default
|
||||
|
||||
def perform(*args)
|
||||
end
|
||||
end
|
||||
@@ -1,9 +1,13 @@
|
||||
class Ahoy::Store < Ahoy::Stores::ActiveRecordStore
|
||||
|
||||
def track_visit(options)
|
||||
StatsJob.perform_later(super)
|
||||
end
|
||||
|
||||
# Track user IP
|
||||
def track_event(name, properties, options)
|
||||
super do |event|
|
||||
event.ip = request.ip
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user