Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mastodon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Pierre Boudes
mastodon
Commits
0dfffb6d
Commit
0dfffb6d
authored
7 years ago
by
Shunsuke Michii
Committed by
Eugen Rochko
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Make faster ProcessFeedService (#3080)
* Add index accounts on uri. * Remove a blank line.
parent
1b0a5658
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
app/services/process_feed_service.rb
+1
-1
1 addition, 1 deletion
app/services/process_feed_service.rb
db/migrate/20170516072309_add_index_accounts_on_uri.rb
+5
-0
5 additions, 0 deletions
db/migrate/20170516072309_add_index_accounts_on_uri.rb
db/schema.rb
+2
-1
2 additions, 1 deletion
db/schema.rb
with
8 additions
and
2 deletions
app/services/process_feed_service.rb
+
1
−
1
View file @
0dfffb6d
...
@@ -209,7 +209,7 @@ class ProcessFeedService < BaseService
...
@@ -209,7 +209,7 @@ class ProcessFeedService < BaseService
if
TagManager
.
instance
.
web_domain?
(
url
.
host
)
if
TagManager
.
instance
.
web_domain?
(
url
.
host
)
Account
.
find_local
(
url
.
path
.
gsub
(
'/users/'
,
''
))
Account
.
find_local
(
url
.
path
.
gsub
(
'/users/'
,
''
))
else
else
Account
.
find_by
(
uri:
href
)
||
Account
.
find_by
(
url:
href
)
||
FetchRemoteAccountService
.
new
.
call
(
href
)
Account
.
where
(
uri:
href
)
.
or
(
Account
.
where
(
url:
href
)
).
first
||
FetchRemoteAccountService
.
new
.
call
(
href
)
end
end
end
end
...
...
This diff is collapsed.
Click to expand it.
db/migrate/20170516072309_add_index_accounts_on_uri.rb
0 → 100644
+
5
−
0
View file @
0dfffb6d
class
AddIndexAccountsOnUri
<
ActiveRecord
::
Migration
[
5.0
]
def
change
add_index
:accounts
,
:uri
end
end
This diff is collapsed.
Click to expand it.
db/schema.rb
+
2
−
1
View file @
0dfffb6d
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
#
#
# It's strongly recommended that you check this file into your version control system.
# It's strongly recommended that you check this file into your version control system.
ActiveRecord
::
Schema
.
define
(
version:
201705
08230434
)
do
ActiveRecord
::
Schema
.
define
(
version:
201705
16072309
)
do
# These are extensions that must be enabled in order to support this database
# These are extensions that must be enabled in order to support this database
enable_extension
"plpgsql"
enable_extension
"plpgsql"
...
@@ -50,6 +50,7 @@ ActiveRecord::Schema.define(version: 20170508230434) do
...
@@ -50,6 +50,7 @@ ActiveRecord::Schema.define(version: 20170508230434) do
t
.
datetime
"last_webfingered_at"
t
.
datetime
"last_webfingered_at"
t
.
index
"(((setweight(to_tsvector('simple'::regconfig, (display_name)::text), 'A'::
\"
char
\"
) || setweight(to_tsvector('simple'::regconfig, (username)::text), 'B'::
\"
char
\"
)) || setweight(to_tsvector('simple'::regconfig, (COALESCE(domain, ''::character varying))::text), 'C'::
\"
char
\"
)))"
,
name:
"search_index"
,
using: :gin
t
.
index
"(((setweight(to_tsvector('simple'::regconfig, (display_name)::text), 'A'::
\"
char
\"
) || setweight(to_tsvector('simple'::regconfig, (username)::text), 'B'::
\"
char
\"
)) || setweight(to_tsvector('simple'::regconfig, (COALESCE(domain, ''::character varying))::text), 'C'::
\"
char
\"
)))"
,
name:
"search_index"
,
using: :gin
t
.
index
"lower((username)::text), lower((domain)::text)"
,
name:
"index_accounts_on_username_and_domain_lower"
,
using: :btree
t
.
index
"lower((username)::text), lower((domain)::text)"
,
name:
"index_accounts_on_username_and_domain_lower"
,
using: :btree
t
.
index
[
"uri"
],
name:
"index_accounts_on_uri"
,
using: :btree
t
.
index
[
"url"
],
name:
"index_accounts_on_url"
,
using: :btree
t
.
index
[
"url"
],
name:
"index_accounts_on_url"
,
using: :btree
t
.
index
[
"username"
,
"domain"
],
name:
"index_accounts_on_username_and_domain"
,
unique:
true
,
using: :btree
t
.
index
[
"username"
,
"domain"
],
name:
"index_accounts_on_username_and_domain"
,
unique:
true
,
using: :btree
end
end
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment