Class: Webhookdb::Concurrent::Pool

Inherits:
Object
  • Object
show all
Defined in:
lib/webhookdb/concurrent.rb

Overview

Baseclass for pools for doing work across threads. Note that these concurrent pools are not for repeated use, like a normal threadpool. They are for ‘fanning out’ a single operation across multiple threads.

Tasks should not error; if they error, the pool will becomes inoperable: post and join will re-raise the first task error.

Direct Known Subclasses

ParallelizedPool, SerialPool

Instance Method Summary collapse

Instance Method Details

#joinObject

Wait for all work to finish. Re-raise the first exception for any pool error.

Raises:

  • (NotImplementedError)


23
# File 'lib/webhookdb/concurrent.rb', line 23

def join = raise NotImplementedError

#postObject

Add work to the pool. Will block if no workers are free. Re-raises the pool’s error if the pool has an error. This is important as we don’t want the caller to keep adding work, if the pool is inoperable.

Raises:

  • (NotImplementedError)


19
# File 'lib/webhookdb/concurrent.rb', line 19

def post(&) = raise NotImplementedError