<commit_before>require "http"
require "logger"
require "json"
require "colorize"
require "secure_random"
require "kilt"
require "kilt/slang"
require "./amber/**"

module Amber
  class Server
    property port : Int32
    property name : String
    property env : String
    property log : Logger
    property secret : String
    property host : String = "0.0.0.0"
    property port_reuse : Bool = false

    def self.instance
      @@instance ||= new
    end

    def self.settings
      instance
    end

    def initialize
      @app_path = __FILE__
      @name = "My Awesome App"
      @port = 8080
      @env = "development".colorize(:yellow).to_s
      @log = ::Logger.new(STDOUT)
      @log.level = ::Logger::INFO
      @secret = SecureRandom.hex
      @host = "0.0.0.0"
      @port_reuse = true
    end

    def run
      ENV["THREAD_COUNT"] ||= "1"
      thread_count = ENV["THREAD_COUNT"].to_i
      if Cluster.master?
        while(thread_count > 0)
          Cluster.fork ({"id" => thread_count.to_s})
          thread_count -= 1
        end
        sleep<commit_msg>don't start a new process if thread count is one. (#92)<commit_after>require "http"
require "logger"
require "json"
require "colorize"
require "secure_random"
require "kilt"
require "kilt/slang"
require "./amber/**"

module Amber
  class Server
    property port : Int32
    property name : String
    property env : String
    property log : Logger
    property secret : String
    property host : String = "0.0.0.0"
    property port_reuse : Bool = false

    def self.instance
      @@instance ||= new
    end

    def self.settings
      instance
    end

    def initialize
      @app_path = __FILE__
      @name = "My Awesome App"
      @port = 8080
      @env = "development".colorize(:yellow).to_s
      @log = ::Logger.new(STDOUT)
      @log.level = ::Logger::INFO
      @secret = SecureRandom.hex
      @host = "0.0.0.0"
      @port_reuse = true
    end

    def run
      ENV["THREAD_COUNT"] ||= "1"
      thread_count = ENV["THREAD_COUNT"].to_i
      if Cluster.master? && thread_count > 1
        while(thread_count > 0)
          Cluster.fork ({"id" => thread_count.to_s})
          thread_count -= 1
        end
        sleep
{'fraction_non_alphanumeric': 0.1127141568981064, 'fraction_numerical': 0.016681695220919748, 'mean_word_length': 2.3020833333333335, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 4, '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': '1399334', 'n_tokens_mistral': 743, 'n_tokens_neox': 693, 'n_words': 195}