Open marceloboeira opened 7 years ago
Right now the indexer "query" is done on every request... it would be better to have it as a query...
Instead of
Episode.all.each do |episode| if episde.... end
Episode.not_indexed.each do |episode| ... end
where Episode.not_indexed is:
Episode.not_indexed
class Episode scope :not_indexed -> { where(indexed: nil).or(....) } end
That improves the performance because it does not fetch all episodes from mongo to ruby's memory so it can run against the if-else.
(Add a mongo-index to updated_at && indexed_at so it can run faster)
updated_at
indexed_at
related to #13
Right now the indexer "query" is done on every request... it would be better to have it as a query...
Instead of
where
Episode.not_indexed
is:That improves the performance because it does not fetch all episodes from mongo to ruby's memory so it can run against the if-else.
(Add a mongo-index to
updated_at
&&indexed_at
so it can run faster)