Skip to content
This repository has been archived by the owner on Mar 24, 2024. It is now read-only.

Commit

Permalink
Merge pull request #142 from lendingblock/master
Browse files Browse the repository at this point in the history
Release 1.0.1
  • Loading branch information
krotkiewicz authored Nov 14, 2018
2 parents c91e3d7 + e757e18 commit fede215
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion openapi/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Minimal OpenAPI asynchronous server application
"""

__version__ = '1.0.0'
__version__ = '1.0.1'
11 changes: 10 additions & 1 deletion openapi/db/container.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
import asyncpg

import sqlalchemy as sa
Expand All @@ -6,6 +7,10 @@
from ..exc import ImproperlyConfigured


DBPOOL_MIN_SIZE = int(os.environ.get('DBPOOL_MIN_SIZE') or '10')
DBPOOL_MAX_SIZE = int(os.environ.get('DBPOOL_MAX_SIZE') or '10')


class Database:
"""A container for tables in a database
"""
Expand Down Expand Up @@ -41,7 +46,11 @@ def __getattr__(self, name):
return super().__getattribute__(name)

async def connect(self) -> None:
self._pool = await asyncpg.create_pool(self._dsn)
self._pool = await asyncpg.create_pool(
self._dsn,
min_size=DBPOOL_MIN_SIZE,
max_size=DBPOOL_MAX_SIZE,
)

@asynccontextmanager
async def connection(self) -> asyncpg.Connection:
Expand Down

0 comments on commit fede215

Please sign in to comment.