<commit_before>class Sibling::Instruction < ActiveRecord::Base

  attr_accessible :uid, :name, :published_at

  has_many :deploys
  has_many :siblings, through: :deploys

  validates :uid, uniqueness: true
  validates :name, presence: true
  validates :published_at, presence: true

  after_save :deploy

  class << self
    def feed_url
      ENV["G5_CONFIGURATOR_FEED_URL"]
    end

    def feed
      Microformats2.parse(feed_url)
    end

    def consume_feed
      feed.entries.map do |hentry|
        find_or_create_from_hentry(hentry) if targets_me?(hentry)
      end.compact
    rescue OpenURI::HTTPError, "304 Not Modified"
    end

    def async_consume_feed
      Resque.enqueue(SiblingInstructionConsumer)<commit_msg>Rescue error correctly<commit_after>require 'open-uri'

class Sibling::Instruction < ActiveRecord::Base

  attr_accessible :uid, :name, :published_at

  has_many :deploys
  has_many :siblings, through: :deploys

  validates :uid, uniqueness: true
  validates :name, presence: true
  validates :published_at, presence: true

  after_save :deploy

  class << self
    def feed_url
      ENV["G5_CONFIGURATOR_FEED_URL"]
    end

    def feed
      Microformats2.parse(feed_url)
    end

    def consume_feed
      feed.entries.map do |hentry|
        find_or_create_from_hentry(hentry) if targets_me?(hentry)
      end.compact
    rescue OpenURI::HTTPError => e
      raise e unless /304 Not Modified/ =~ e.message
    end

    def async_consume_feed
      Resque.enqueue(SiblingInstructionConsumer)
{'fraction_non_alphanumeric': 0.07672131147540984, 'fraction_numerical': 0.006557377049180328, 'mean_word_length': 3.5825825825825826, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7536498', 'n_tokens_mistral': 522, 'n_tokens_neox': 503, 'n_words': 118}