-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Fix matcher-tree creation happening per filter instance #37797
base: main
Are you sure you want to change the base?
Conversation
…th every instance of the rate_limit_quota filter Signed-off-by: Brian Surber <bsurber@google.com>
c622a7d
to
bb9a277
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, modulo some nits.
/wait
if (callbacks_ != nullptr) { | ||
data_ptr_ = std::make_unique<Http::Matching::HttpMatchingDataImpl>(callbacks_->streamInfo()); | ||
} else { | ||
if (!data_ptr_) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i actually prefer data_ptr == nullptr
style throughout this file. That is more readable for pointer type.
} | ||
|
||
return [&, config = std::move(config), config_with_hash_key, tls_store, | ||
matcher](Http::FilterChainFactoryCallbacks& callbacks) -> void { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for the matcher
shared pointer here, you only need to make copy (i.e., increase ref count once) once.
For example, in the RateLimitQuotaFilter constructor, it is passed by value which will achieve the need of copy above. Other places can just be move
Commit Message: Move matcher-tree creation to config.cc so that it isn't recreated with every instance of the rate_limit_quota filter
Additional Description:
Risk Level:
Testing: Manual testing in-progress
Docs Changes:
Release Notes:
Platform Specific Features:
[Optional Runtime guard:]
Fixes #37534