<commit_before>class UserPoller < Service
  def perform
    logger.info "UserPoller running..."

    users_to_poll.each do |user|
      logger.info "Polling #{user.domain}"

      begin
        UserFetcher.perform(user.url)
        user.poll!
      rescue StandardError => e
        logger.error "Error while polling #{user.domain}: #{e.message}"
      end
    end

    logger.info "UserPoller done."
  end

  private

  def users_to_poll
    User.can_be_polled.order('Random()').first(5)
  end
end
<commit_msg>More userful log output in UserPoller<commit_after>class UserPoller < Service
  def perform
    users_to_poll.each do |user|
      logger.info "Polling #{user.domain}"

      begin
        UserFetcher.perform(user.url)
        posts = user.poll!
        logger.info "Received #{posts.size} from #{user.domain}."
      rescue StandardError => e
        logger.error "Error while polling #{user.domain}: #{e.message}"
      end
    end
  end

  private

  def users_to_poll
    User.can_be_polled.order('Random()').first(5)
  end
end

{'fraction_non_alphanumeric': 0.10834132310642378, 'fraction_numerical': 0.0019175455417066154, 'mean_word_length': 2.663157894736842, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '5495465', 'n_tokens_mistral': 343, 'n_tokens_neox': 329, 'n_words': 81}