<commit_before>module Delayed
  module MessageSending
    def send_later(method, *args)
      Delayed::Job.enqueue Delayed::PerformableMethod.new(self, method.to_sym, args)
    end

    def send_later_enqueue_args(method, enqueue_args = {}, *args)
      # support procs/methods as enqueue arguments
      duped = false
      enqueue_args.each do |k,v|
        if v.respond_to?(:call)
          enqueue_args = enqueue_args.dup unless duped
          duped = true
          enqueue_args[k] = v.call(self)
        end
      end

      Delayed::Job.enqueue(Delayed::PerformableMethod.new(self, method.to_sym, args), enqueue_args)
    end

    def send_later_with_queue(method, queue, *args)
      send_later_enqueue_args(method, { :queue => queue }, *args)
    end

    def send_at(time, method, *args)
      send_later_enqueue_args(method,
                          { :priority => 0, :run_at => time }, *args)
    end

    def send_at_with_queue(time, method, queue, *args)
      send_later_enqueue_args(method,
                          { :priority => 0, :run_at => time, :queue => queue },
                          *args)
    end

    module ClassMethods
      def handle_asynchronously(method, enqueue_args = {})
        aliased_method, punctuation = method.to_s.sub(/([?!=])$/, ''), $1
        with_method, without_method = "#{aliased_method}_with_send_later#{punctuation}", "#{aliased_method}_without_send_later#{punctuation}"
        define_method(with_method) do |*args|
          send_later_enqueue_args(without_method, enqueue_args, *args)
        end<commit_msg>don't use highest priority for send_at delayed jobs<commit_after>module Delayed
  module MessageSending
    def send_later(method, *args)
      Delayed::Job.enqueue Delayed::PerformableMethod.new(self, method.to_sym, args)
    end

    def send_later_enqueue_args(method, enqueue_args = {}, *args)
      # support procs/methods as enqueue arguments
      duped = false
      enqueue_args.each do |k,v|
        if v.respond_to?(:call)
          enqueue_args = enqueue_args.dup unless duped
          duped = true
          enqueue_args[k] = v.call(self)
        end
      end

      Delayed::Job.enqueue(Delayed::PerformableMethod.new(self, method.to_sym, args), enqueue_args)
    end

    def send_later_with_queue(method, queue, *args)
      send_later_enqueue_args(method, { :queue => queue }, *args)
    end

    def send_at(time, method, *args)
      send_later_enqueue_args(method,
                          { :run_at => time }, *args)
    end

    def send_at_with_queue(time, method, queue, *args)
      send_later_enqueue_args(method,
                          { :run_at => time, :queue => queue },
                          *args)
    end

    module ClassMethods
      def handle_asynchronously(method, enqueue_args = {})
        aliased_method, punctuation = method.to_s.sub(/([?!=])$/, ''), $1
        with_method, without_method = "#{aliased_method}_with_send_later#{punctuation}", "#{aliased_method}_without_send_later#{punctuation}"
        define_method(with_method) do |*args|
          send_later_enqueue_args(without_method, enqueue_args, *args)
        end
{'fraction_non_alphanumeric': 0.10902733630006357, 'fraction_numerical': 0.0012714558169103624, 'mean_word_length': 2.800724637681159, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, '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': '5626117', 'n_tokens_mistral': 1042, 'n_tokens_neox': 1008, 'n_words': 196}