With implementation of CONPY-246/247 pool._connections was replaced
by _connections_used and _connections_free to the size should be
calclulated as len(_connections_used + _connections_free)
Added optional parameter "pool_invalidation_interval",
which specifies the validation interval in milliseconds
after which the status of a connection requested from
the pool is checked.
The default values is 500 milliseconds, a value of 0
means that the status will always be checked.
Instead of iterating through all connections and checking the health
status via ping, used and unused connections were separated in different
lists. This ensures that the last used connection will be always the first.
Fixed various coding style stuff detected by flake8.
Added .pre-commit-config.yaml:
With command pre_commit install a hook for flake8 will be
installed.
- All parameter exceptions are now ProgrammingErrors
- A dictionary now might contain more keys than
placeholders in statement
- Fixed unhandled exception when using dictionary as parameter
Display status of connection, cursor and pool class in
string representation.
If an object (cursor, class, connection pool) was closed, the
string representation (tp_repr) now shows the status of the object.
Example:
>>> import mariadb
>>> connection=mariadb.connect()
>>> connection
<mariadb.connection connected to 'localhost' at 0x7f94d77c3b40>
>>> connection.close()
>>> connection
<mariadb.connection (closed) at 0x7f94d77c3b40>
Since resolution of time.monotonic() is not precise enough, we need to use
first connection in ConnectionPool.get_connection() method, in case all
values obtained by time.monotonic() are the same.