Skip to content

Commit

Permalink
fix: create new connection per thread in SQLite test
Browse files Browse the repository at this point in the history
Co-Authored-By: Chris Weaver <chris@onyx.app>
  • Loading branch information
devin-ai-integration[bot] and Chris Weaver committed Jan 30, 2025
1 parent 203c7d4 commit 42460fa
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions backend/tests/unit/onyx/db/test_users.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@


def _call_parallel(engine, email_list: List[str]) -> None:
# Create a new session for each thread to handle SQLite's threading restrictions
# Create a new connection and session for each thread to handle SQLite's threading restrictions
connection = engine.connect()
SessionLocal = sessionmaker(
bind=engine,
bind=connection,
expire_on_commit=False,
autoflush=True,
)
Expand All @@ -27,6 +28,7 @@ def _call_parallel(engine, email_list: List[str]) -> None:
raise
finally:
session.close()
connection.close()


@pytest.mark.parametrize(
Expand Down

0 comments on commit 42460fa

Please sign in to comment.