Skip to content

Commit

Permalink
Merge pull request #158 from MacroConnections/sqlalchemy-connection-p…
Browse files Browse the repository at this point in the history
…ooling

Adding session teardown and changing pool size
  • Loading branch information
kevinzenghu committed Apr 11, 2016
2 parents e4310a4 + 68e3fda commit ba689d9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions config.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ class BaseConfig(object):

COMPRESS = True

SQLALCHEMY_POOL_SIZE=20
SQLALCHEMY_MAX_OVERFLOW=100

COOKIE_DOMAIN = None
REMEMBER_COOKIE_DOMAIN = COOKIE_DOMAIN
SESSION_COOKIE_DOMAIN = COOKIE_DOMAIN
Expand Down
4 changes: 4 additions & 0 deletions dive/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ def create_app(**kwargs):
allow_headers='Content-Type'
)

@app.teardown_appcontext
def shutdown_session(exception=None):
db.session.remove()

ensure_directories(app)
return app

Expand Down

0 comments on commit ba689d9

Please sign in to comment.