Skip to content
Extraits de code Groupes Projets
Valider 11d9b50f rédigé par Maxwell Salzberg's avatar Maxwell Salzberg
Parcourir les fichiers

a solution for a problem with pulling back all visible public ids when querying

after much sleuthing, this is an extremely hacky way to limit the
amount of public post _ids we are pulling back with every query.
previously, for unknown reason, we were pulling back all of them from
people you are connected to, and doing giant in queries which were
causing bad things to happen.  As far as I can tell, we are in fact
keeping track of the page( i.e. max time and offset) so there was no
need to pull all of them back.  This whole file is a huge clusterf*ck,
so it really should just get totally refactored, as the stuff that is
happening is not really as scary as it looks :(
parent a70b057b
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -31,7 +31,7 @@ module User::Querying ...@@ -31,7 +31,7 @@ module User::Querying
opts[:by_members_of] ||= self.aspect_ids opts[:by_members_of] ||= self.aspect_ids
post_ids = klass.connection.select_values(visible_shareable_sql(klass, opts)).map { |id| id.to_i } post_ids = klass.connection.select_values(visible_shareable_sql(klass, opts)).map { |id| id.to_i }
post_ids += klass.connection.select_values(construct_public_followings_sql(opts).to_sql).map {|id| id.to_i } post_ids += klass.connection.select_values("#{construct_public_followings_sql(opts).to_sql} LIMIT #{opts[:limit]}").map {|id| id.to_i }
end end
def visible_shareable_sql(klass, opts={}) def visible_shareable_sql(klass, opts={})
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter