chaturbate_poller.signal_handler

Signal handler for SIGINT and SIGTERM signals.

Attributes

logger

The module-level logger.

Classes

SignalHandler

Signal handler for SIGINT and SIGTERM signals.

Module Contents

chaturbate_poller.signal_handler.logger

The module-level logger.

Type:

logging.Logger

class chaturbate_poller.signal_handler.SignalHandler(loop: asyncio.AbstractEventLoop, stop_future: asyncio.Future[None])[source]

Signal handler for SIGINT and SIGTERM signals.

loop
stop_future
_is_setup = False
async setup() None[source]

Set up signal handlers for SIGINT and SIGTERM asynchronously.

Raises:

RuntimeError – If setup is called more than once.

async handle_signal(sig: signal.Signals) None[source]

Asynchronously handle the received signal.

Parameters:

sig (signal.Signals) – The received signal.

async _shutdown() None[source]

Shut down tasks and clean up gracefully.

async _cancel_tasks() None[source]

Cancel all running tasks except the current one.

Logs any exceptions during cancellation and enforces a timeout.