Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
gab-social
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
gab
social
gab-social
Commits
22ec66d0
Commit
22ec66d0
authored
Jan 11, 2021
by
Fosco Marotto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[fixes] Based on APM findings
parent
0b77b386
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
13 additions
and
11 deletions
+13
-11
app/controllers/api/v1/account_by_username_controller.rb
app/controllers/api/v1/account_by_username_controller.rb
+1
-1
app/controllers/api/v1/timelines/home_controller.rb
app/controllers/api/v1/timelines/home_controller.rb
+2
-1
app/controllers/settings/preferences_controller.rb
app/controllers/settings/preferences_controller.rb
+1
-1
app/models/user.rb
app/models/user.rb
+7
-6
app/services/precompute_feed_service.rb
app/services/precompute_feed_service.rb
+2
-2
No files found.
app/controllers/api/v1/account_by_username_controller.rb
View file @
22ec66d0
# frozen_string_literal: true
class
Api::V1::AccountByUsernameController
<
Empty
Controller
class
Api::V1::AccountByUsernameController
<
API
::
Base
Controller
before_action
:set_account
before_action
:check_account_suspension
before_action
:check_account_local
...
...
app/controllers/api/v1/timelines/home_controller.rb
View file @
22ec66d0
...
...
@@ -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
app/controllers/settings/preferences_controller.rb
View file @
22ec66d0
...
...
@@ -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
...
...
app/models/user.rb
View file @
22ec66d0
...
...
@@ -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?
...
...
app/services/precompute_feed_service.rb
View file @
22ec66d0
...
...
@@ -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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment