[fixes] Based on APM findings
This commit is contained in:
parent
0b77b386a2
commit
22ec66d07f
@ -1,6 +1,6 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class Api::V1::AccountByUsernameController < EmptyController
|
class Api::V1::AccountByUsernameController < API::BaseController
|
||||||
before_action :set_account
|
before_action :set_account
|
||||||
before_action :check_account_suspension
|
before_action :check_account_suspension
|
||||||
before_action :check_account_local
|
before_action :check_account_local
|
||||||
|
@ -62,6 +62,7 @@ class Api::V1::Timelines::HomeController < Api::BaseController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def regeneration_in_progress?
|
def regeneration_in_progress?
|
||||||
Redis.current.exists?("account:#{current_account.id}:regeneration")
|
false
|
||||||
|
# Redis.current.exists?("account:#{current_account.id}:regeneration")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -9,7 +9,7 @@ class Settings::PreferencesController < Settings::BaseController
|
|||||||
|
|
||||||
def update
|
def update
|
||||||
user_settings.update(user_settings_params.to_h)
|
user_settings.update(user_settings_params.to_h)
|
||||||
current_user.force_regeneration!
|
# current_user.force_regeneration!
|
||||||
|
|
||||||
if current_user.update(user_params)
|
if current_user.update(user_params)
|
||||||
I18n.locale = current_user.locale
|
I18n.locale = current_user.locale
|
||||||
|
@ -219,7 +219,7 @@ class User < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def challenge
|
def challenge
|
||||||
#
|
#
|
||||||
end
|
end
|
||||||
|
|
||||||
def password_required?
|
def password_required?
|
||||||
@ -246,7 +246,7 @@ class User < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def force_regeneration!
|
def force_regeneration!
|
||||||
Redis.current.set("account:#{account_id}:regeneration", true)
|
# Redis.current.set("account:#{account_id}:regeneration", true)
|
||||||
end
|
end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
@ -258,7 +258,7 @@ class User < ApplicationRecord
|
|||||||
private
|
private
|
||||||
|
|
||||||
def set_approved
|
def set_approved
|
||||||
self.approved = open_registrations?
|
self.approved = open_registrations?
|
||||||
end
|
end
|
||||||
|
|
||||||
def external?
|
def external?
|
||||||
@ -283,9 +283,10 @@ class User < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def regenerate_feed!
|
def regenerate_feed!
|
||||||
return unless Redis.current.setnx("account:#{account_id}:regeneration", true)
|
# return unless Redis.current.setnx("account:#{account_id}:regeneration", true)
|
||||||
Redis.current.expire("account:#{account_id}:regeneration", 1.day.seconds)
|
# Redis.current.expire("account:#{account_id}:regeneration", 1.day.seconds)
|
||||||
RegenerationWorker.perform_async(account_id)
|
# RegenerationWorker.perform_async(account_id)
|
||||||
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
def needs_feed_update?
|
def needs_feed_update?
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
class PrecomputeFeedService < BaseService
|
class PrecomputeFeedService < BaseService
|
||||||
def call(account)
|
def call(account)
|
||||||
FeedManager.instance.populate_feed(account)
|
# FeedManager.instance.populate_feed(account)
|
||||||
ensure
|
ensure
|
||||||
Redis.current.del("account:#{account.id}:regeneration")
|
# Redis.current.del("account:#{account.id}:regeneration")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user