FIX: Requests were not being logged correctly
`enable` was defaulting to `nil` which is not what we wanted.
This commit is contained in:
parent
e1bd57007b
commit
096eca0ee8
|
@ -16,15 +16,16 @@ class ApplicationRequest < ActiveRecord::Base
|
||||||
include CachedCounting
|
include CachedCounting
|
||||||
|
|
||||||
def self.disable
|
def self.disable
|
||||||
@enabled = false
|
@disabled = true
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.enable
|
def self.enable
|
||||||
@enabled = true
|
@disabled = false
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.increment!(type, opts = nil)
|
def self.increment!(type, opts = nil)
|
||||||
perform_increment!(redis_key(type), opts) if @enabled
|
return if @disabled
|
||||||
|
perform_increment!(redis_key(type), opts)
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.write_cache!(date = nil)
|
def self.write_cache!(date = nil)
|
||||||
|
|
|
@ -128,6 +128,9 @@ module TestSetup
|
||||||
# code that runs inside jobs. run_later! means they are put on the redis
|
# code that runs inside jobs. run_later! means they are put on the redis
|
||||||
# queue and never processed.
|
# queue and never processed.
|
||||||
Jobs.run_later!
|
Jobs.run_later!
|
||||||
|
|
||||||
|
# Don't track ApplicationRequests in test mode unless opted in
|
||||||
|
ApplicationRequest.disable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue