From 44a0eed6d8b3a940d2a36f320ebe1bda24b4bf6b Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Wed, 16 Mar 2016 11:11:00 +0100 Subject: [PATCH] In certain cases puma does not set application root. Moved to set cache_store via config/application.rb. --- config/application.rb | 2 +- config/environments/production.rb | 6 ------ lib/cache.rb | 8 +------- 3 files changed, 2 insertions(+), 14 deletions(-) diff --git a/config/application.rb b/config/application.rb index b599993a4..59a17ebcf 100644 --- a/config/application.rb +++ b/config/application.rb @@ -48,7 +48,7 @@ module Zammad config.api_path = '/api/v1' # define cache store - config.cache_store = :file_store, "tmp/cache_file_store_#{Rails.env}" + config.cache_store = :file_store, "#{Rails.root}/tmp/cache_file_store_#{Rails.env}" # default preferences by role config.preferences_default_by_role = { diff --git a/config/environments/production.rb b/config/environments/production.rb index 85a53a8d0..5600b66ed 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -54,9 +54,6 @@ Rails.application.configure do # Use a different logger for distributed setups. # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new) - # Use a different cache store in production. - # config.cache_store = :mem_cache_store - # Enable serving of images, stylesheets, and JavaScripts from an asset server. # config.action_controller.asset_host = 'http://assets.example.com' @@ -83,7 +80,4 @@ Rails.application.configure do # format log config.log_formatter = Logger::Formatter.new - # define cache store - config.cache_store = :file_store, 'tmp/cache_file_store_production' - end diff --git a/lib/cache.rb b/lib/cache.rb index d4ed9235a..b225c2dd0 100644 --- a/lib/cache.rb +++ b/lib/cache.rb @@ -10,8 +10,6 @@ delete a cache def self.delete(key) Rails.cache.delete(key.to_s) - rescue => e - Rails.logger.error "ERROR: Cache.delete #{e.message}" end =begin @@ -30,11 +28,7 @@ write a cache if !params[:expires_in] params[:expires_in] = 7.days end - begin - Rails.cache.write(key.to_s, data, params) - rescue => e - Rails.logger.error "ERROR: Cache.write #{e.message}" - end + Rails.cache.write(key.to_s, data, params) end =begin