Skip to content

fix: ensure connections are closed after sync operations#355

Merged
MatLBS merged 2 commits intogetnao:mainfrom
Dozie2001:fix/auth_iss
Mar 3, 2026
Merged

fix: ensure connections are closed after sync operations#355
MatLBS merged 2 commits intogetnao:mainfrom
Dozie2001:fix/auth_iss

Conversation

@Dozie2001
Copy link
Copy Markdown
Contributor

@Dozie2001 Dozie2001 commented Feb 24, 2026

  • Fix database connection leaks in nao sync — connections opened via db_config.connect() were never closed, exhausting the connection pool across repeated
    syncs or large projects
  • Wrap connection usage in try/finally blocks with conn.disconnect() in sync_database(), DatabaseConfig.execute_sql(), and BigQueryConfig.execute_sql()

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 4 files

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="cli/nao_core/commands/sync/providers/databases/provider.py">

<violation number="1" location="cli/nao_core/commands/sync/providers/databases/provider.py:64">
P2: The `try` block should start immediately after `conn = db_config.connect()` to guarantee `conn.disconnect()` runs in the `finally` even if the intervening `console.print(...)` raises. As written, an exception in `console.print` would leak the connection — the exact bug this PR aims to fix.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Comment thread cli/nao_core/commands/sync/providers/databases/provider.py
@MatLBS MatLBS merged commit 0f888bc into getnao:main Mar 3, 2026
2 checks passed
Bl3f pushed a commit to rsivapr/nao that referenced this pull request Mar 4, 2026
* fix: ensure connections are closed after sync operations

* refactor: move connection message inside try block for clarity
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants