<commit_before>class ProcessFeed
  include Callee

  param :feed
  option :logger, optional: true, default: -> { Rails.logger }

  def call
    Honeybadger.context(feed_id: feed.try(:id), feed_name: feed.try(:name))
    @started_at = Time.current
    generate_new_posts
    create_data_point
  end

  private

  attr_reader :started_at

  def generate_new_posts
    logger.info("---> new posts: #{normalized_entities_count}; errors: #{errors_count}")
    feed.update(refreshed_at: started_at)

    normalized_entities.each { |normalized_entity| push(normalized_entity) }
  end

  def push(normalized_entity)
    next unless normalized_entity
    logger.info("---> creating post; uid: [#{normalized_entity.uid}]")
    post = normalized_entity.find_or_create_post
    feed.update(last_post_created_at: last_post_created_at)
    next unless post.ready?
    logger.info("---> publishing post; uid: [#{post.uid}]")
    Push.call(post)
  end

  def feed_id
    feed.id
  end<commit_msg>Fix control flow<commit_after>class ProcessFeed
  include Callee

  param :feed
  option :logger, optional: true, default: -> { Rails.logger }

  def call
    Honeybadger.context(feed_id: feed.try(:id), feed_name: feed.try(:name))
    @started_at = Time.current
    generate_new_posts
    create_data_point
  end

  private

  attr_reader :started_at

  def generate_new_posts
    logger.info("---> new posts: #{normalized_entities_count}; errors: #{errors_count}")
    feed.update(refreshed_at: started_at)

    normalized_entities.each { |normalized_entity| push(normalized_entity) }
  end

  def push(normalized_entity)
    return unless normalized_entity
    logger.info("---> creating post; uid: [#{normalized_entity.uid}]")
    post = normalized_entity.find_or_create_post
    feed.update(last_post_created_at: last_post_created_at)
    return unless post.ready?
    logger.info("---> publishing post; uid: [#{post.uid}]")
    Push.call(post)
  end

  def feed_id
    feed.id
  end
{'fraction_non_alphanumeric': 0.11082867310625318, 'fraction_numerical': 0.0, 'mean_word_length': 4.00763358778626, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '3488507', 'n_tokens_mistral': 659, 'n_tokens_neox': 640, 'n_words': 137}