Sha256: c51a9c37b4f8253f7a258aa54c401b70eead64e3cc31dae9e305cf74094b02b0
Contents?: true
Size: 515 Bytes
Versions: 2
Compression:
Stored size: 515 Bytes
Contents
require 'thread' require_relative 'setup/test_helper' class StaticPoolTest < Querrel::Test def test_never_more_than_max_threads max_threads = 10 p = Querrel::StaticPool.new(max_threads) thread_counts = [] thread_semaphore = Mutex.new 50.times do p.enqueue do thread_semaphore.synchronize do thread_counts << Thread.list.count{ |t| t.status == "run" } end end end p.do_your_thang! assert thread_counts.all?{ |c| c <= max_threads } end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
querrel-1.4.0 | test/static_pool_test.rb |
querrel-1.3.0 | test/static_pool_test.rb |