<commit_before>require 'fiber_pool'

module Rack
  class FiberPool
    def initialize(app)
      @app = app
      @fiber_pool = ::FiberPool.new
      yield @fiber_pool if block_given?
    end

    def call(env)
      call_app = lambda do
        result = @app.call(env)
        env['async.callback'].call result
      end
      
      @fiber_pool.spawn(&call_app)
      throw :async
    end
  end
end<commit_msg>Use size constant for tunable pool size, not the best solution but better.<commit_after>require 'fiber_pool'

module Rack
  class FiberPool
    SIZE = 100

    def initialize(app)
      @app = app
      @fiber_pool = ::FiberPool.new(SIZE)
      yield @fiber_pool if block_given?
    end

    def call(env)
      call_app = lambda do
        result = @app.call(env)
        env['async.callback'].call result
      end
      
      @fiber_pool.spawn(&call_app)
      throw :async
    end
  end
end
{'fraction_non_alphanumeric': 0.08489525909592062, 'fraction_numerical': 0.0033076074972436605, 'mean_word_length': 2.2661870503597124, 'pattern_counts': {'":': 0, '<': 3, '<?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': '883555', 'n_tokens_mistral': 308, 'n_tokens_neox': 296, 'n_words': 79}