diff --git a/app/controllers/api/base_controller.rb b/app/controllers/api/base_controller.rb index f6e85528..80cb4a28 100644 --- a/app/controllers/api/base_controller.rb +++ b/app/controllers/api/base_controller.rb @@ -63,7 +63,10 @@ class Api::BaseController < ApplicationController end def current_resource_owner - @current_user ||= User.find(doorkeeper_token.resource_owner_id) if doorkeeper_token + @current_user ||= Rails.cache.fetch("dk:user:#{doorkeeper_token.resource_owner_id}", expires_in: 25.hours) do + User.find(doorkeeper_token.resource_owner_id) if doorkeeper_token + end + #@current_user ||= User.find(doorkeeper_token.resource_owner_id) if doorkeeper_token end def current_user diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index f621bff5..190f83d1 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -94,7 +94,9 @@ class ApplicationController < ActionController::Base end def current_session - @current_session ||= SessionActivation.find_by(session_id: cookies.signed['_session_id']) + @current_session ||= Rails.cache.fetch("dk:sess:#{cookies.signed['_session_id']}", expires_in: 25.hours) do + SessionActivation.find_by(session_id: cookies.signed['_session_id']) + end end def cache_collection(raw, klass) diff --git a/lib/gabsocial/migration_helpers.rb b/lib/gabsocial/migration_helpers.rb index 5451ffca..1a574071 100644 --- a/lib/gabsocial/migration_helpers.rb +++ b/lib/gabsocial/migration_helpers.rb @@ -43,7 +43,7 @@ module GabSocial module MigrationHelpers # Stub for Database.postgresql? from GitLab def self.postgresql? - ActiveRecord::Base.configurations[Rails.env]['adapter'].casecmp('postgresql').zero? + ActiveRecord::Base.configurations[Rails.env]['adapter'].casecmp('postgresql_makara').zero? end # Stub for Database.mysql? from GitLab @@ -57,7 +57,8 @@ module GabSocial if GabSocial::MigrationHelpers.postgresql? 'information_schema.role_table_grants' else - 'mysql.user' + 'information_schema.role_table_grants' + #'mysql.user' end def self.scope_to_current_user