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