Skip to content

fix: Lazy-load database connection to prevent unnecessary instantiations#3628

Closed
AlexDev404 wants to merge 2 commits intoDokploy:canaryfrom
AlexDev404:fix/prevent-unnecessary-db-connections
Closed

fix: Lazy-load database connection to prevent unnecessary instantiations#3628
AlexDev404 wants to merge 2 commits intoDokploy:canaryfrom
AlexDev404:fix/prevent-unnecessary-db-connections

Conversation

@AlexDev404
Copy link
Contributor

@AlexDev404 AlexDev404 commented Feb 7, 2026

Previously, the database connection was initialized on import, even when unused. This commit defers connection initialization until the db variable is first accessed, preventing redundant database connections when the module is imported.

What is this PR about?

Please describe in a short paragraph what this PR is about.

Checklist

Before submitting this PR, please make sure that:

Issues related (if applicable)

No response

Screenshots (if applicable)

No response

Previously, the database connection was initialized on import, even when unused. This commit defers connection initialization until the `db` variable is first accessed, preventing redundant database connections when the module is imported.
@AlexDev404 AlexDev404 closed this Feb 7, 2026
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.

1 participant