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 :(
This commit is contained in:
Maxwell Salzberg 2012-04-10 00:40:34 -07:00
parent a70b057bf5
commit 11d9b50f3a

View file

@ -31,7 +31,7 @@ module User::Querying
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(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
def visible_shareable_sql(klass, opts={})