simulstream.server.websocket_server.SpeechProcessorPool

class simulstream.server.websocket_server.SpeechProcessorPool(speech_processor_config: SimpleNamespace, size: int, acquire_timeout: int)

Bases: object

A pool of speech processors initialized at startup and made available to clients.

Parameters:
  • speech_processor_config (SimpleNamespace) – configuration for the speech processors to create.

  • size (int) – number of speech processors to have in the pool.

  • acquire_timeout (int) – timeout (in seconds) for waiting the availability of a speech processor.

__init__(speech_processor_config: SimpleNamespace, size: int, acquire_timeout: int)

Methods

__init__(speech_processor_config, size, ...)

acquire()

Acquire one process from the pool and release it automatically.

acquire()

Acquire one process from the pool and release it automatically.

Returns:

a speech processor available for usage.

Return type:

SpeechProcessor

Raises:

TimeoutError – if no speech processor is available within the configured timeout.