PingingPool(size=10, default_timeout=10, ping_interval=3000, labels=None)
Concrete session pool implementation:
Pre-allocates / creates a fixed number of sessions.
Sessions are used in "round-robin" order (LRU first).
"Pings" existing sessions in the background after a specified interval via an API call (
Blocks, with a timeout, when
getis called on an empty pool. Raises after timing out.
putis called on a full pool. That error is never expected in normal practice, as users should be calling
putwhenever in need of a session.
The application is responsible for calling
ping at appropriate
times, e.g. from a background thread.
fixed pool size
default timeout, in seconds, to wait for a returned session.
interval at which to ping sessions.
(Optional) user-assigned labels for sessions created by the pool.
Inheritancebuiltins.object > AbstractSessionPool > PingingPool
Associate the pool with a database.
database used by the pool to create sessions when needed.
Delete all sessions in the pool.
Check a session out from the pool.
seconds to block waiting for an available session
|`queue.Empty||if the queue is empty.|
|Session||an existing session from the pool, or a newly-created session.|
Refresh maybe-expired sessions in the pool.
This method is designed to be called from a background thread, or during the "idle" phase of an event loop.
Return a session to the pool.
Never blocks: if the pool is full, raises.
the session being returned.
|`queue.Full||if the queue is full.|