Skip to content

Commit

Permalink
FIX: Requests were not being logged correctly
Browse files Browse the repository at this point in the history
`enable` was defaulting to `nil` which is not what we wanted.
  • Loading branch information
eviltrout committed May 20, 2020
1 parent e1bd570 commit 096eca0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
7 changes: 4 additions & 3 deletions app/models/application_request.rb
Expand Up @@ -16,15 +16,16 @@ class ApplicationRequest < ActiveRecord::Base
include CachedCounting

def self.disable
@enabled = false
@disabled = true
end

def self.enable
@enabled = true
@disabled = false
end

def self.increment!(type, opts = nil)
perform_increment!(redis_key(type), opts) if @enabled
return if @disabled
perform_increment!(redis_key(type), opts)
end

def self.write_cache!(date = nil)
Expand Down
3 changes: 3 additions & 0 deletions spec/rails_helper.rb
Expand Up @@ -128,6 +128,9 @@ def self.test_setup(x = nil)
# code that runs inside jobs. run_later! means they are put on the redis
# queue and never processed.
Jobs.run_later!

# Don't track ApplicationRequests in test mode unless opted in
ApplicationRequest.disable
end
end

Expand Down

2 comments on commit 096eca0

@discoursebot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit has been mentioned on Discourse Meta. There might be relevant details there:

https://meta.discourse.org/t/analytics-in-admin-page-is-no-longer-working/152022/10

@discoursebot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit has been mentioned on Discourse Meta. There might be relevant details there:

https://meta.discourse.org/t/consolidated-pageviews-not-working-since-update-2-5-0-beta4/152516/2

Please sign in to comment.