<commit_before>require 'ffi-rzmq'

module Sprockets
  module Rails
    class StaticCompiler
      KILL_MESSAGE = "die die die!!!!"

      def compile_with_workers
        unless ::Rails.application.config.assets.parallel_compile
          return compile_with_workers
        end

        worker_count = (Rails.application.config.assets.compile_workers || 4).to_i

        paths = env.each_logical_path.reject {|logical_path| !compile_path?(logical_path)}
        total_count = paths.length
        manifest = {}

        begin
          workers = 1.upto(worker_count).map do
            fork do
              child_context = ZMQ::Context.new(1)
              child_receiver = child_context.socket(ZMQ::PULL)
              child_sender = child_context.socket(ZMQ::PUSH)
              child_receiver.connect("tcp://127.0.0.1:55546")
              child_sender.connect("tcp://127.0.0.1:55547")

              # Send synchronization string
              child_sender.send_string(Process.pid.to_s)

              loop do
                # Allocate, 0mq requires it. (lol)
                begin<commit_msg>Whoops!<commit_after>require 'ffi-rzmq'

module Sprockets
  module Rails
    class StaticCompiler
      KILL_MESSAGE = "die die die!!!!"

      def compile_with_workers
        unless ::Rails.application.config.assets.parallel_compile
          return compile_without_workers
        end

        worker_count = (Rails.application.config.assets.compile_workers || 4).to_i

        paths = env.each_logical_path.reject {|logical_path| !compile_path?(logical_path)}
        total_count = paths.length
        manifest = {}

        begin
          workers = 1.upto(worker_count).map do
            fork do
              child_context = ZMQ::Context.new(1)
              child_receiver = child_context.socket(ZMQ::PULL)
              child_sender = child_context.socket(ZMQ::PUSH)
              child_receiver.connect("tcp://127.0.0.1:55546")
              child_sender.connect("tcp://127.0.0.1:55547")

              # Send synchronization string
              child_sender.send_string(Process.pid.to_s)

              loop do
                # Allocate, 0mq requires it. (lol)
                begin
{'fraction_non_alphanumeric': 0.09421939007737824, 'fraction_numerical': 0.023668639053254437, 'mean_word_length': 2.0655509065550905, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '3948201', 'n_tokens_mistral': 683, 'n_tokens_neox': 630, 'n_words': 109}