def __init__(self, config, pool_size=None): def _make_connection(): return make_connection(config) def _validate_connection(connection): return validate_connection(connection) self.connection_pool = helper.Pool( _make_connection, _validate_connection, pool_size if pool_size else config['pool_size'])
def __init__(self, config, pool_size=None): self._local = threading.local() def _make_connection(): return make_connection(config, autocommit=True) def _validate_connection(connection): return validate_connection(connection) self._connection_pool = helper.Pool( _make_connection, _validate_connection, pool_size if pool_size else config.get('pool_size', 4))
def __init__(self, config, pool_size=None): self._local = threading.local() self.pool_size = pool_size or config.get('pool_size', 50) def _make_connection(): connection = make_connection(config, autocommit=True) connection.timestamp = time.time() return connection def _validate_connection(connection): return validate_connection(connection) self._connection_pool = helper.Pool(_make_connection, _validate_connection, self.pool_size)