defer counting to avoid race condition

This commit is contained in:
Sam 2015-02-05 12:19:21 +11:00
parent bfa96811c1
commit 8690c7c49f
1 changed files with 4 additions and 4 deletions

View File

@ -140,16 +140,16 @@ module Middleware
def call(env)
helper = Helper.new(env)
Scheduler::Defer.later "Track view" do
self.class.log_request_on_site(env,helper)
end
if helper.cacheable?
helper.cached or helper.cache(@app.call(env))
else
@app.call(env)
end
ensure
Scheduler::Defer.later "Track view" do
self.class.log_request_on_site(env,helper)
end
end
end