Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move indexer attributes to a query #12

Open
marceloboeira opened this issue Sep 10, 2017 · 1 comment
Open

Move indexer attributes to a query #12

marceloboeira opened this issue Sep 10, 2017 · 1 comment
Assignees

Comments

@marceloboeira
Copy link
Contributor

marceloboeira commented Sep 10, 2017

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:

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)

@marceloboeira
Copy link
Contributor Author

related to #13

@joaocv3 joaocv3 self-assigned this Sep 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants