Skip to content

Commit

Permalink
connection: pessimistic disconnect handling
Browse files Browse the repository at this point in the history
Adds ``pool_pre_ping`` for pessimistic disconnect handling. Helps to
reconnect to database from stalled connections from long-running
pods. Closes reanahub#58. Addresses reanahub#133.
  • Loading branch information
tiborsimko committed Oct 7, 2021
1 parent a9160bb commit 5e2e34c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGES.rst
Expand Up @@ -7,6 +7,7 @@ Version 0.8.0 (UNRELEASED)
- Adds new disk usage retrieval methods using canonical (bytes) and human-readable (KiB) units. (``User``, ``Workflow``)
- Adds new properties ``started_at`` and ``finished_at`` to the ``Job`` model, updated on status change.
- Adds ``get_priority`` workflow method, that combines both complexity and concurrency, to pass to the scheduler.
- Adds database connection pool pre-ping to prevent stalled database connections problems.
- Changes disk quota calculation functions to allow passing raw bytes to increase the used quota.
- Removes support for Python 2.

Expand Down
4 changes: 2 additions & 2 deletions reana_db/database.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
#
# This file is part of REANA.
# Copyright (C) 2018 CERN.
# Copyright (C) 2018, 2019, 2020, 2021 CERN.
#
# REANA is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
Expand All @@ -19,7 +19,7 @@

from reana_db.models import Base # isort:skip # noqa

engine = create_engine(SQLALCHEMY_DATABASE_URI)
engine = create_engine(SQLALCHEMY_DATABASE_URI, pool_pre_ping=False)
Session = scoped_session(sessionmaker(autocommit=False, autoflush=False, bind=engine))
Base.query = Session.query_property()

Expand Down

0 comments on commit 5e2e34c

Please sign in to comment.