marceloboeira/feedcast

View on GitHub
app/services/episode_services/index_outdated.rb

Summary

Maintainability
A
0 mins
Test Coverage
B
88%
module EpisodeServices
  class IndexOutdated
    def call
      Episode.all.each do |episode|
        if episode.indexed_at.nil? || episode.updated_at > episode.indexed_at
          schedule_indexer_for(episode)
        end
      end
    end

    private

    def schedule_indexer_for(episode)
      EpisodeIndexerJob.perform_later(episode.uuid)
    end
  end
end