class WorkerPool

Overview

a pool of fibers ready to execute tasks there is no bound on growth so long running tasks like websockets can run without starving other tasks. The aim of this pool is to reduce the impact of fiber allocation to a typical workload

Defined in:

worker_pool.cr

Constant Summary

Log = ::Log.for(self)
VERSION = "2.0.3"

Constructors

Instance Method Summary

Constructor Detail

def self.new(initial_size : Int32, reap_period : Time::Span = 15.seconds) #

[View source]

Instance Method Detail

def available #

number of workers waiting to be allocated work


[View source]
def close #

fibers are discarded once they complete and no new work will be accepted


[View source]
def finalize #

ensure the fibers complete if the pool goes out of scope


[View source]
def initial_size : Int32 #

[View source]
def perform(&block : Proc(Nil)) #

perform a task using the pool


[View source]
def running? #

is the fiber pool running


[View source]
def size : Int32 #

number of fibers in the pool


[View source]