Set redis as default cache store

This commit is contained in:
Eugene Burmakin 2024-04-21 18:12:07 +02:00
parent 5315836c6a
commit d99e6d6f50
6 changed files with 23 additions and 6 deletions

View file

@ -1 +1 @@
0.1.8
0.1.8.1

View file

@ -5,6 +5,17 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).
## [0.1.8.1] — 2024-04-21
### Changed
- Set Redis as default cache store
### Fixed
- Consider timezone when parsing datetime params in points controller
- Add rescue for check version service class
## [0.1.8] — 2024-04-21
### Added

View file

@ -19,13 +19,13 @@ class PointsController < ApplicationController
def start_at
return 1.month.ago.beginning_of_day.to_i if params[:start_at].nil?
Time.parse(params[:start_at]).to_i
Time.zone.parse(params[:start_at]).to_i
end
def end_at
return Time.zone.today.end_of_day.to_i if params[:end_at].nil?
Time.parse(params[:end_at]).to_i
Time.zone.parse(params[:end_at]).to_i
end
def distance

View file

@ -7,7 +7,12 @@ class CheckAppVersion
end
def call
begin
latest_version = JSON.parse(Net::HTTP.get(URI.parse(@repo_url)))[0]['name']
rescue
return false
end
latest_version != @app_version
end
end

View file

@ -23,14 +23,14 @@ Rails.application.configure do
config.action_controller.perform_caching = true
config.action_controller.enable_fragment_cache_logging = true
config.cache_store = :memory_store
config.cache_store = :redis_cache_store, { url: ENV['REDIS_URL'] }
config.public_file_server.headers = {
"Cache-Control" => "public, max-age=#{2.days.to_i}"
}
else
config.action_controller.perform_caching = false
config.cache_store = :null_store
config.cache_store = :redis_cache_store, { url: ENV['REDIS_URL'] }
end
# Store uploaded files on the local file system (see config/storage.yml for options).

View file

@ -66,6 +66,7 @@ Rails.application.configure do
# Use a different cache store in production.
# config.cache_store = :mem_cache_store
config.cache_store = :redis_cache_store, { url: ENV['REDIS_URL'] }
# Use a real queuing backend for Active Job (and separate queues per environment).
# config.active_job.queue_adapter = :resque