Skip to content

Move indexer attributes to a query #12

Description

@marceloboeira

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)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions