<commit_before>require_dependency 'discourse_hub'
require_dependency 'discourse_updates'

module Jobs
  class VersionCheck < Jobs::Base

    def execute(args)
      if SiteSetting.version_checks
        json = DiscourseHub.discourse_version_check
        DiscourseUpdates.latest_version = json['latestVersion']
        DiscourseUpdates.critical_updates_available = json['criticalUpdates']
        DiscourseUpdates.missing_versions_count = json['missingVersionsCount']
      end
      true
    end

  end
end<commit_msg>Fail version_check job silently in development mode<commit_after>require_dependency 'discourse_hub'
require_dependency 'discourse_updates'

module Jobs
  class VersionCheck < Jobs::Base

    def execute(args)
      if SiteSetting.version_checks
        begin
          json = DiscourseHub.discourse_version_check
          DiscourseUpdates.latest_version = json['latestVersion']
          DiscourseUpdates.critical_updates_available = json['criticalUpdates']
          DiscourseUpdates.missing_versions_count = json['missingVersionsCount']
        rescue => e
          raise e unless Rails.env == 'development' # Fail version check silently in development mode
        end
      end
      true
    end

  end
end
{'fraction_non_alphanumeric': 0.060064935064935064, 'fraction_numerical': 0.0, 'mean_word_length': 3.58364312267658, 'pattern_counts': {'":': 0, '<': 5, '<?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': '1520061', 'n_tokens_mistral': 342, 'n_tokens_neox': 323, 'n_words': 73}