forked from cybrespace/mastodon
		
	Make faster ProcessFeedService (#3080)
* Add index accounts on uri. * Remove a blank line.
This commit is contained in:
		
							parent
							
								
									1b0a5658f1
								
							
						
					
					
						commit
						0dfffb6dcb
					
				
					 3 changed files with 8 additions and 2 deletions
				
			
		|  | @ -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 | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
							
								
								
									
										5
									
								
								db/migrate/20170516072309_add_index_accounts_on_uri.rb
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								db/migrate/20170516072309_add_index_accounts_on_uri.rb
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,5 @@ | ||||||
|  | class AddIndexAccountsOnUri < ActiveRecord::Migration[5.0] | ||||||
|  |   def change | ||||||
|  |     add_index :accounts, :uri | ||||||
|  |   end | ||||||
|  | end | ||||||
|  | @ -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: 20170508230434) do | ActiveRecord::Schema.define(version: 20170516072309) 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 | ||||||
|     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 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue