Update DEFAULT_POSTGRES_MAX_POOL_SIZE

Even though ``0`` is documented as the max pool size in the aiopg docs, setting it to 0 causes an exception in `aiopg.pool.Pool._fill_free_pool`:

```
  File "/Users/gavinr/Source/PSE/anabroker/env/lib/python3.7/site-packages/aiopg/pool.py", line 208, in _fill_free_pool
    if override_min and self.size < self.maxsize:
TypeError: '<' not supported between instances of 'int' and 'NoneType'
```

Set to the same default as aiopg, @ 10.
This commit is contained in:
Gavin M. Roy 2020-04-13 14:20:09 -04:00
parent 3ba6c8c069
commit 86b6c022f0
4 changed files with 51 additions and 51 deletions

View file

@ -21,28 +21,28 @@ Configuration
------------- -------------
The following table details the environment variable configuration options: The following table details the environment variable configuration options:
+---------------------------------+--------------------------------------------------+-------------------+ +---------------------------------+--------------------------------------------------+-----------+
| Variable | Definition | Default | | Variable | Definition | Default |
+=================================+==================================================+===================+ +=================================+==================================================+===========+
| ``POSTGRES_URL`` | The PostgreSQL URL to connect to | | | ``POSTGRES_URL`` | The PostgreSQL URL to connect to | |
+---------------------------------+--------------------------------------------------+-------------------+ +---------------------------------+--------------------------------------------------+-----------+
| ``POSTGRES_MAX_POOL_SIZE`` | Maximum connection count to Postgres per backend | ``0`` (Unlimited) | | ``POSTGRES_MAX_POOL_SIZE`` | Maximum connection count to Postgres per backend | ``10`` |
+---------------------------------+--------------------------------------------------+-------------------+ +---------------------------------+--------------------------------------------------+-----------+
| ``POSTGRES_MIN_POOL_SIZE`` | Minimum or starting pool size. | ``1`` | | ``POSTGRES_MIN_POOL_SIZE`` | Minimum or starting pool size. | ``1`` |
+---------------------------------+--------------------------------------------------+-------------------+ +---------------------------------+--------------------------------------------------+-----------+
| ``POSTGRES_CONNECTION_TIMEOUT`` | The maximum time in seconds to spend attempting | ``10`` | | ``POSTGRES_CONNECTION_TIMEOUT`` | The maximum time in seconds to spend attempting | ``10`` |
| | to create a new connection. | | | | to create a new connection. | |
+---------------------------------+--------------------------------------------------+-------------------+ +---------------------------------+--------------------------------------------------+-----------+
| ``POSTGRES_CONNECTION_TTL`` | Time-to-life in seconds for a pooled connection. | ``300`` | | ``POSTGRES_CONNECTION_TTL`` | Time-to-life in seconds for a pooled connection. | ``300`` |
+---------------------------------+--------------------------------------------------+-------------------+ +---------------------------------+--------------------------------------------------+-----------+
| ``POSTGRES_QUERY_TIMEOUT`` | Maximum execution time for a query in seconds. | ``60`` | | ``POSTGRES_QUERY_TIMEOUT`` | Maximum execution time for a query in seconds. | ``60`` |
+---------------------------------+--------------------------------------------------+-------------------+ +---------------------------------+--------------------------------------------------+-----------+
| ``POSTGRES_HSTORE`` | Enable HSTORE support in the client. | ``FALSE`` | | ``POSTGRES_HSTORE`` | Enable HSTORE support in the client. | ``FALSE`` |
+---------------------------------+--------------------------------------------------+-------------------+ +---------------------------------+--------------------------------------------------+-----------+
| ``POSTGRES_JSON`` | Enable JSON support in the client. | ``FALSE`` | | ``POSTGRES_JSON`` | Enable JSON support in the client. | ``FALSE`` |
+---------------------------------+--------------------------------------------------+-------------------+ +---------------------------------+--------------------------------------------------+-----------+
| ``POSTGRES_UUID`` | Enable UUID support in the client. | ``TRUE`` | | ``POSTGRES_UUID`` | Enable UUID support in the client. | ``TRUE`` |
+---------------------------------+--------------------------------------------------+-------------------+ +---------------------------------+--------------------------------------------------+-----------+
Requirements Requirements
------------ ------------

View file

@ -1 +1 @@
1.0.1 1.0.2

View file

@ -3,25 +3,25 @@ Configuration
:py:mod:`sprockets-postgres <sprockets_postgres>` is configured via environment variables. The following table :py:mod:`sprockets-postgres <sprockets_postgres>` is configured via environment variables. The following table
details the configuration options and their defaults. details the configuration options and their defaults.
+---------------------------------+--------------------------------------------------+-------------------+ +---------------------------------+--------------------------------------------------+-----------+
| Variable | Definition | Default | | Variable | Definition | Default |
+=================================+==================================================+===================+ +=================================+==================================================+===========+
| ``POSTGRES_URL`` | The PostgreSQL URL to connect to | | | ``POSTGRES_URL`` | The PostgreSQL URL to connect to | |
+---------------------------------+--------------------------------------------------+-------------------+ +---------------------------------+--------------------------------------------------+-----------+
| ``POSTGRES_MAX_POOL_SIZE`` | Maximum connection count to Postgres per backend | ``0`` (Unlimited) | | ``POSTGRES_MAX_POOL_SIZE`` | Maximum connection count to Postgres per backend | ``10`` |
+---------------------------------+--------------------------------------------------+-------------------+ +---------------------------------+--------------------------------------------------+-----------+
| ``POSTGRES_MIN_POOL_SIZE`` | Minimum or starting pool size. | ``1`` | | ``POSTGRES_MIN_POOL_SIZE`` | Minimum or starting pool size. | ``1`` |
+---------------------------------+--------------------------------------------------+-------------------+ +---------------------------------+--------------------------------------------------+-----------+
| ``POSTGRES_CONNECTION_TIMEOUT`` | The maximum time in seconds to spend attempting | ``10`` | | ``POSTGRES_CONNECTION_TIMEOUT`` | The maximum time in seconds to spend attempting | ``10`` |
| | to create a new connection. | | | | to create a new connection. | |
+---------------------------------+--------------------------------------------------+-------------------+ +---------------------------------+--------------------------------------------------+-----------+
| ``POSTGRES_CONNECTION_TTL`` | Time-to-life in seconds for a pooled connection. | ``300`` | | ``POSTGRES_CONNECTION_TTL`` | Time-to-life in seconds for a pooled connection. | ``300`` |
+---------------------------------+--------------------------------------------------+-------------------+ +---------------------------------+--------------------------------------------------+-----------+
| ``POSTGRES_QUERY_TIMEOUT`` | Maximum execution time for a query in seconds. | ``60`` | | ``POSTGRES_QUERY_TIMEOUT`` | Maximum execution time for a query in seconds. | ``60`` |
+---------------------------------+--------------------------------------------------+-------------------+ +---------------------------------+--------------------------------------------------+-----------+
| ``POSTGRES_HSTORE`` | Enable HSTORE support in the client. | ``FALSE`` | | ``POSTGRES_HSTORE`` | Enable HSTORE support in the client. | ``FALSE`` |
+---------------------------------+--------------------------------------------------+-------------------+ +---------------------------------+--------------------------------------------------+-----------+
| ``POSTGRES_JSON`` | Enable JSON support in the client. | ``FALSE`` | | ``POSTGRES_JSON`` | Enable JSON support in the client. | ``FALSE`` |
+---------------------------------+--------------------------------------------------+-------------------+ +---------------------------------+--------------------------------------------------+-----------+
| ``POSTGRES_UUID`` | Enable UUID support in the client. | ``TRUE`` | | ``POSTGRES_UUID`` | Enable UUID support in the client. | ``TRUE`` |
+---------------------------------+--------------------------------------------------+-------------------+ +---------------------------------+--------------------------------------------------+-----------+

View file

@ -19,8 +19,8 @@ DEFAULT_POSTGRES_CONNECTION_TIMEOUT = 10
DEFAULT_POSTGRES_CONNECTION_TTL = 300 DEFAULT_POSTGRES_CONNECTION_TTL = 300
DEFAULT_POSTGRES_HSTORE = 'FALSE' DEFAULT_POSTGRES_HSTORE = 'FALSE'
DEFAULT_POSTGRES_JSON = 'FALSE' DEFAULT_POSTGRES_JSON = 'FALSE'
DEFAULT_POSTGRES_MAX_POOL_SIZE = 0 DEFAULT_POSTGRES_MAX_POOL_SIZE = '10'
DEFAULT_POSTGRES_MIN_POOL_SIZE = 1 DEFAULT_POSTGRES_MIN_POOL_SIZE = '1'
DEFAULT_POSTGRES_QUERY_TIMEOUT = 120 DEFAULT_POSTGRES_QUERY_TIMEOUT = 120
DEFAULT_POSTGRES_UUID = 'TRUE' DEFAULT_POSTGRES_UUID = 'TRUE'
@ -368,14 +368,14 @@ class ApplicationMixin:
return self.stop(loop) return self.stop(loop)
self._postgres_pool = pool.Pool( self._postgres_pool = pool.Pool(
os.environ['POSTGRES_URL'], os.environ['POSTGRES_URL'],
minsize=int(
os.environ.get(
'POSTGRES_MIN_POOL_SIZE',
DEFAULT_POSTGRES_MIN_POOL_SIZE)),
maxsize=int( maxsize=int(
os.environ.get( os.environ.get(
'POSTGRES_MAX_POOL_SIZE', 'POSTGRES_MAX_POOL_SIZE',
DEFAULT_POSTGRES_MAX_POOL_SIZE)), DEFAULT_POSTGRES_MAX_POOL_SIZE)),
minsize=int(
os.environ.get(
'POSTGRES_MIN_POOL_SIZE',
DEFAULT_POSTGRES_MIN_POOL_SIZE)),
timeout=int( timeout=int(
os.environ.get( os.environ.get(
'POSTGRES_CONNECT_TIMEOUT', 'POSTGRES_CONNECT_TIMEOUT',