<commit_before>module Travis
  module Live
    module Pusher
      class Task
        class << self
          def perform(*args)
            new(*args).run
          end
        end

        attr_reader :payload, :params

        def initialize(payload, params = {})
          @payload = payload.deep_symbolize_keys
          @params  = params.deep_symbolize_keys
        end

        def run
          timeout after: params[:timeout] || 60 do
            process
          end
        end

        def event
          params[:event]
        end

        def client_event
          @client_event ||= (event =~ /job:.*/ ? event.gsub(/(test|configure):/, '') : event)
        end

        def channels
          channels = private_channels? ? ["repo-#{repo_id}"] : ['common']
          channels.map { |channel| [channel_prefix, channels].compact.join('-') }
        end

        private

          def process
            channels.each { |channel| trigger(channel, payload) }<commit_msg>Send messages for public repos for both per-repo and common channels<commit_after>module Travis
  module Live
    module Pusher
      class Task
        class << self
          def perform(*args)
            new(*args).run
          end
        end

        attr_reader :payload, :params

        def initialize(payload, params = {})
          @payload = payload.deep_symbolize_keys
          @params  = params.deep_symbolize_keys
        end

        def run
          timeout after: params[:timeout] || 60 do
            process
          end
        end

        def event
          params[:event]
        end

        def client_event
          @client_event ||= (event =~ /job:.*/ ? event.gsub(/(test|configure):/, '') : event)
        end

        def channels
          channels = ["repo-#{repo_id}"]
          channels << "common" unless private_channels?
          channels.map { |channel| [channel_prefix, channels].compact.join('-') }
        end

        private

          def process
            channels.each { |channel| trigger(channel, payload) }
{'fraction_non_alphanumeric': 0.09912109375, 'fraction_numerical': 0.001953125, 'mean_word_length': 1.6370656370656371, 'pattern_counts': {'":': 0, '<': 9, '<?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': '5500792', 'n_tokens_mistral': 547, 'n_tokens_neox': 527, 'n_words': 144}