<commit_before>require_relative '../../lib/batch_jobs'

class FeedRefresher
  include BatchJobs
  include Sidekiq::Worker

  def perform(batch, priority_refresh)
    feed_ids = build_ids(batch)
    count = priority_refresh ? 1 : 0

    Sidekiq::Client.push_bulk(
      'args'  => build_arguments(feed_ids, count),
      'class' => 'FeedRefresherFetcher',
      'queue' => 'feed_refresher_fetcher',
      'retry' => false
    )<commit_msg>Only try to push jobs if there are jobs to push. Fixes #177.<commit_after>require_relative '../../lib/batch_jobs'

class FeedRefresher
  include BatchJobs
  include Sidekiq::Worker

  def perform(batch, priority_refresh)
    feed_ids = build_ids(batch)
    count = priority_refresh ? 1 : 0
    jobs = build_arguments(feed_ids, count)
    if jobs.present?
      Sidekiq::Client.push_bulk(
        'args'  => jobs,
        'class' => 'FeedRefresherFetcher',
        'queue' => 'feed_refresher_fetcher',
        'retry' => false
      )
    end
{'fraction_non_alphanumeric': 0.11644535240040858, 'fraction_numerical': 0.007150153217568948, 'mean_word_length': 3.242424242424242, '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': '4305993', 'n_tokens_mistral': 333, 'n_tokens_neox': 322, 'n_words': 71}