Skip to content

Commit

Permalink
revert disabling pooling on celery worker tasks (#5592)
Browse files Browse the repository at this point in the history
  • Loading branch information
adamsachs authored and eastandwestwind committed Dec 11, 2024
1 parent 6631def commit a97a421
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 16 deletions.
3 changes: 2 additions & 1 deletion src/fides/api/tasks/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,11 @@ def get_new_session(self) -> ContextManager[Session]:
if self._task_engine is None:
self._task_engine = get_db_engine(
config=CONFIG,
pool_size=CONFIG.database.task_engine_pool_size,
max_overflow=CONFIG.database.task_engine_max_overflow,
keepalives_idle=CONFIG.database.task_engine_keepalives_idle,
keepalives_interval=CONFIG.database.task_engine_keepalives_interval,
keepalives_count=CONFIG.database.task_engine_keepalives_count,
disable_pooling=True,
)

# same for the sessionmaker
Expand Down
15 changes: 0 additions & 15 deletions tests/ops/tasks/test_database_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,21 +42,6 @@ def always_failing_session_maker(self):
mock_maker.side_effect = OperationalError("connection failed", None, None)
return mock_maker

@pytest.mark.parametrize(
"config_fixture", [None, "mock_config_changed_db_engine_settings"]
)
def test_get_task_session(self, config_fixture, request):
if config_fixture is not None:
request.getfixturevalue(
config_fixture
) # used to invoke config fixture if provided
pool_size = CONFIG.database.task_engine_pool_size
max_overflow = CONFIG.database.task_engine_max_overflow
t = DatabaseTask()
session: Session = t.get_new_session()
engine: Engine = session.get_bind()
assert isinstance(engine.pool, NullPool)

def test_retry_on_operational_error(self, recovering_session_maker):
"""Test that session creation retries on OperationalError"""

Expand Down

0 comments on commit a97a421

Please sign in to comment.