<commit_before>require 'sidekiq'

module EmberSecureBuilder
  class CrossBrowserTestBatchResultsWorker
    class IncompleteResultsError < StandardError; end

    include Sidekiq::Worker

    def perform(build)
      batch_results = CrossBrowserTestBatchResults.new build
      batch_results.upload_results

      unless batch_results.completed?
        throw IncompleteResultsError, "Not finished yet. #{batch_results.pending_jobs.length} jobs still pending."
      end
    end
  end
end
<commit_msg>Do not consider an incomplete batch an exception.<commit_after>require 'sidekiq'

module EmberSecureBuilder
  class CrossBrowserTestBatchResultsWorker
    include Sidekiq::Worker

    def perform(build, times_requeued = 0)
      batch_results = CrossBrowserTestBatchResults.new build
      batch_results.upload_results

      if batch_results.completed?
        #batch_results.cleanup
      else if times_requeued < 30
        CrossBrowserTestBatchResultsWorker.perform_in 120, build, times_requeued + 1
      end
    end
  end
end

{'fraction_non_alphanumeric': 0.04844961240310078, 'fraction_numerical': 0.006782945736434108, 'mean_word_length': 3.8497652582159625, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '7489918', 'n_tokens_mistral': 294, 'n_tokens_neox': 277, 'n_words': 72}