<commit_before>require "unicorn"
require "rack/content_length"
require "rack/chunked"

module Hooves
  # Rack Handler to use Unicorn for Rails::Application.run!
  module Unicorn
    class << self
      def run(app, options={})
        options[:listeners] = ["#{options.delete(:Host)}:#{options.delete(:Port)}"]
        options[:worker_processes] = 3

        if options.delete(:debugger)
          $DEBUG = true

          # It's difficult to debug with more than one worker on the go
          options[:worker_processes] = 1
          # The default timeout (30s) doesn't leave much time for debugging
          options[:timeout] = 120
        end

        daemonize = options.delete(:daemonize)

        # override any settings that you want in your config file
        options[:config_file] = find_config_file

        # :pid option is stronly discouraged except in unicorn config file
        uni_options = options.select { |k, v| [:listeners, :worker_processes, :config_file, :timeout].include?(k) }

        if daemonize
          ::Unicorn::Launcher.daemonize!(uni_options)<commit_msg>Allow specifying the number of workers<commit_after>require "unicorn"
require "rack/content_length"
require "rack/chunked"

module Hooves
  # Rack Handler to use Unicorn for Rails::Application.run!
  module Unicorn
    class << self
      def run(app, options={})
        options[:listeners] = ["#{options.delete(:Host)}:#{options.delete(:Port)}"]
        options[:worker_processes] ||= 3

        if options.delete(:debugger)
          $DEBUG = true

          # It's difficult to debug with more than one worker on the go
          options[:worker_processes] = 1
          # The default timeout (30s) doesn't leave much time for debugging
          options[:timeout] = 120
        end

        daemonize = options.delete(:daemonize)

        # override any settings that you want in your config file
        options[:config_file] = find_config_file

        # :pid option is stronly discouraged except in unicorn config file
        uni_options = options.select { |k, v| [:listeners, :worker_processes, :config_file, :timeout].include?(k) }

        if daemonize
          ::Unicorn::Launcher.daemonize!(uni_options)
{'fraction_non_alphanumeric': 0.10140334993209597, 'fraction_numerical': 0.006337709370755998, 'mean_word_length': 2.9323843416370106, 'pattern_counts': {'":': 0, '<': 7, '<?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': '5792534', 'n_tokens_mistral': 654, 'n_tokens_neox': 605, 'n_words': 188}