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

PHPORM-248 register command subscriber only when logs are enabled #3167

Merged
merged 2 commits into from
Oct 4, 2024

Conversation

GromNaN
Copy link
Member

@GromNaN GromNaN commented Oct 3, 2024

Fix PHPORM-248
Fix #3166

The command subscriber has significant impact on command execution. It can be enabled only when necessary.

Checklist

  • Add tests and ensure they pass

@GromNaN GromNaN requested a review from a team as a code owner October 3, 2024 20:02
@GromNaN GromNaN requested review from alcaeus and jmikola and removed request for alcaeus October 3, 2024 20:02
src/Connection.php Outdated Show resolved Hide resolved
{
parent::disableQueryLog(); // TODO: Change the autogenerated stub

$this->connection->removeSubscriber($this->commandSubscriber);
Copy link
Member

Choose a reason for hiding this comment

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

Needs a safe guard in case no subscriber is registered

Copy link
Member Author

Choose a reason for hiding this comment

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

Added a condition to never add or remove the subscriber twice.

@GromNaN GromNaN requested a review from alcaeus October 4, 2024 07:47
@GromNaN GromNaN merged commit a5ef5c0 into mongodb:5.x Oct 4, 2024
27 checks passed
@GromNaN GromNaN deleted the PHPORM-248 branch October 4, 2024 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Performance Regression 5.x
2 participants