imefisto/eventsauce-pdo-message-repository-swoole

Swoole coroutine-aware connection pool for eventsauce-pdo-message-repository

Maintainers

Package info

github.com/imefisto/eventsauce-pdo-message-repository-swoole

pkg:composer/imefisto/eventsauce-pdo-message-repository-swoole

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

1.0.0 2026-05-30 22:02 UTC

This package is auto-updated.

Last update: 2026-05-30 23:07:54 UTC


README

Swoole coroutine-aware connection pool for eventsauce-pdo-message-repository.

Installation

composer require imefisto/eventsauce-pdo-message-repository-swoole

Usage

SwooleConnectionManager is a drop-in replacement for DefaultConnectionManager:

use Imefisto\EventSaucePDOMessageRepository\Swoole\SwooleConnectionManager;

$connection = new SwooleConnectionManager(
    dsn: 'mysql:host=127.0.0.1;dbname=mydb',
    user: 'user',
    password: 'password',
    maxSize: 10
);

$repo = new PDOMessageRepository($connection, $tableName, $serializer);

How it works

  • Connections are created lazily up to $maxSize
  • When all connections are checked out, get() suspends the calling coroutine until one is returned — no busy-waiting, no connection leak
  • Coroutine context makes the pool safe: Swoole only yields at I/O / channel operations, so the connection count check and increment are atomic