Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use singleton for db and redis connections #1112

Merged
merged 5 commits into from
Dec 17, 2024

Conversation

nilmerg
Copy link
Member

@nilmerg nilmerg commented Dec 17, 2024

Required for an upcoming change. Though, I wanted to change this already a long time ago.

There's absolutely no need to have several open connections to the same database. Which was the case before, since the connection was established for each user (class) of the Database trait.

But with PDO, queries are by default all serially processed. Only for MySQL it is possible to change this, by disabling query buffering.

But Icinga DB Web is incompatible anyway, with disabled query buffering, and so changing this to a singleton is fine in my opinion.

I've deliberately kept the Database trait, to not update all usages of it. In case only the connection is required, the trait still has its use.

@nilmerg nilmerg requested a review from raviks789 December 17, 2024 12:57
@nilmerg nilmerg self-assigned this Dec 17, 2024
@cla-bot cla-bot bot added the cla/signed CLA is signed by all contributors of a PR label Dec 17, 2024
@nilmerg nilmerg force-pushed the use-singleton-for-db-and-redis-connections branch from 5fd0272 to 8af314a Compare December 17, 2024 13:03
@nilmerg nilmerg requested a review from raviks789 December 17, 2024 15:22
Copy link
Contributor

@raviks789 raviks789 left a comment

Choose a reason for hiding this comment

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

LGTM

@nilmerg nilmerg force-pushed the use-singleton-for-db-and-redis-connections branch from 96e85db to c57298e Compare December 17, 2024 15:33
@nilmerg nilmerg merged commit 8cf9302 into dependencies Dec 17, 2024
22 checks passed
@nilmerg nilmerg deleted the use-singleton-for-db-and-redis-connections branch December 17, 2024 15:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla/signed CLA is signed by all contributors of a PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants