Module: LlmCostTracker::Ingestion::Pool

Defined in:
lib/llm_cost_tracker/ingestion/pool.rb

Constant Summary collapse

DEFAULT_POOL_SIZE =
2
MUTEX =
Mutex.new

Class Method Summary collapse

Class Method Details

.poolObject



14
15
16
17
18
19
20
21
22
23
# File 'lib/llm_cost_tracker/ingestion/pool.rb', line 14

def pool
  return @pool if @pool && @pid == Process.pid

  MUTEX.synchronize do
    next @pool if @pool && @pid == Process.pid

    @pid = Process.pid
    @pool = connect!
  end
end