-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Labels
Description
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....
endEpisode.not_indexed.each do |episode|
...
endwhere Episode.not_indexed is:
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)