Sha256: 3d60b34ff308f8759eb00f72b9c22295eb4fbdec7073d2f3a8052ddb1e41d6e0

Contents?: true

Size: 518 Bytes

Versions: 1

Compression:

Stored size: 518 Bytes

Contents

# frozen_string_literal: true

module Europeana
  module Feeds
    class FetchJob < ActiveJob::Base
      queue_as :feeds

      def perform(url)
        @url = url

        @feed = ::Feedjira::Feed.fetch_and_parse(@url)

        feed_cache_key = "feed/#{@url}"
        cached_feed = Rails.cache.fetch(feed_cache_key)

        if cached_feed.blank? || cached_feed.last_modified != @feed.last_modified
          Rails.cache.write(feed_cache_key, @feed)
          @updated = true
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
europeana-feeds-0.0.1 app/jobs/europeana/feeds/fetch_job.rb