Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ ruby '3.3.8'

# default gems
gem 'bootsnap', require: false
gem 'connection_pool', '~> 2.4' # pin to 2.x; 3.0+ breaks Rails 7.2 redis_cache_store
gem 'pg', '~> 1.1'
gem 'puma', '~> 5.0'
gem 'rails'
Expand All @@ -22,8 +21,6 @@ gem 'blazer' # for querying the database

# monitoring & performance
gem 'delayed_job_active_record'
gem 'hiredis'
gem 'redis'
gem 'sentry-rails'
gem 'sentry-ruby'
gem 'skylight' # performance monitoring: https://www.skylight.io/app/applications/670fP418RH7v/recent/6h/endpoints
Expand Down
8 changes: 0 additions & 8 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ GEM
hashie (5.0.0)
heroicon (1.0.0)
rails (>= 5.2)
hiredis (0.6.3)
i18n (1.14.8)
concurrent-ruby (~> 1.0)
io-console (0.8.2)
Expand Down Expand Up @@ -312,10 +311,6 @@ GEM
psych (>= 4.0.0)
tsort
redcarpet (3.6.0)
redis (5.2.0)
redis-client (>= 0.22.0)
redis-client (0.22.2)
connection_pool
regexp_parser (2.9.2)
reline (0.6.3)
io-console (~> 0.5)
Expand Down Expand Up @@ -411,14 +406,12 @@ DEPENDENCIES
blazer
bootsnap
capybara
connection_pool (~> 2.4)
debug
delayed_job_active_record
factory_bot_rails
faker
groupdate
heroicon
hiredis
kaminari
mini_magick
minitest-spec-rails
Expand All @@ -435,7 +428,6 @@ DEPENDENCIES
rack-mini-profiler
rails
redcarpet
redis
rubocop
selenium-webdriver
sentry-rails
Expand Down
12 changes: 1 addition & 11 deletions app/controllers/api/metrics_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,6 @@ def index
metric = project.metrics.find_by(name: params[:metric_name])
return head :not_found if metric.nil?

render json: metric_data(metric)
end

private

def metric_data(metric)
Rails
.cache
.fetch(['api/metrics#index', 'metric_data', @user, metric], expires_in: 12.hours) do
{ value: metric.value, occurrences: metric.occurrences.pluck(:text) }
end
render json: { value: metric.value, occurrences: metric.occurrences.pluck(:text) }
end
end
12 changes: 4 additions & 8 deletions app/models/metric.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,10 @@ def owners
end

def chart_data(owners: nil)
Rails
.cache
.fetch([self, 'chart_data', owners], expires_in: 12.hours) do
daily_reports
.index_with { |report| get_count(report, owners) }
.compact
.transform_keys { |report| report.date.iso8601[0...10] }
end
daily_reports
.index_with { |report| get_count(report, owners) }
.compact
.transform_keys { |report| report.date.iso8601[0...10] }
end

def clean_up!
Expand Down
4 changes: 1 addition & 3 deletions config/cable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,4 @@ test:
adapter: test

production:
adapter: redis
url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %>
channel_prefix: cherry_production
adapter: async
3 changes: 0 additions & 3 deletions config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,6 @@
# Prepend all log lines with the following tags.
config.log_tags = [:request_id]

# Use a different cache store in production.
config.cache_store = :redis_cache_store, { url: ENV.fetch('REDIS_URL', nil) }

# Use a real queuing backend for Active Job (and separate queues per environment).
config.active_job.queue_adapter = :delayed_job
# config.active_job.queue_name_prefix = "cherry_production"
Expand Down
Loading
Loading