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

apache2-mod-proxy: better handling regexp extraction #9609

Conversation

russoz
Copy link
Collaborator

@russoz russoz commented Jan 22, 2025

SUMMARY

Improve the handling of the data extraction using regexp by pre-compiling the regular expressions.

ISSUE TYPE
  • Refactoring Pull Request
COMPONENT NAME

apache2_mod_proxy

@ansibullbot
Copy link
Collaborator

@ansibullbot ansibullbot added module module plugins plugin (any type) labels Jan 22, 2025
@felixfontein felixfontein added check-before-release PR will be looked at again shortly before release and merged if possible. backport-10 Automatically create a backport for the stable-10 branch labels Jan 23, 2025
@@ -246,7 +246,7 @@ class BalancerMember(object):
"""

def __init__(self, management_url, balancer_url, module):
self.host = regexp_extraction(management_url, str(EXPRESSION), 4)
self.host = regexp_extraction(management_url, EXPRESSION, 4)
self.management_url = str(management_url)
self.protocol = regexp_extraction(management_url, EXPRESSION, 3)
self.port = regexp_extraction(management_url, EXPRESSION, 5)
Copy link
Collaborator

Choose a reason for hiding this comment

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

This function is seaching for the same regex in the same string four times, every time using a different group of the result. That looks very inefficient to me... I guess this could be improved at some point :)

@felixfontein felixfontein removed the check-before-release PR will be looked at again shortly before release and merged if possible. label Jan 23, 2025
@felixfontein felixfontein merged commit bf5c7f8 into ansible-collections:main Jan 23, 2025
138 checks passed
Copy link

patchback bot commented Jan 23, 2025

Backport to stable-10: 💚 backport PR created

✅ Backport PR branch: patchback/backports/stable-10/bf5c7f8be886ec2a26d6eae35ef459e4908ee522/pr-9609

Backported as #9616

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

patchback bot pushed a commit that referenced this pull request Jan 23, 2025
* apache2-mod-proxy: better handling regexp extraction

* add changelog frag

(cherry picked from commit bf5c7f8)
@felixfontein
Copy link
Collaborator

@russoz thanks!

felixfontein pushed a commit that referenced this pull request Jan 23, 2025
…dling regexp extraction (#9616)

apache2-mod-proxy: better handling regexp extraction (#9609)

* apache2-mod-proxy: better handling regexp extraction

* add changelog frag

(cherry picked from commit bf5c7f8)

Co-authored-by: Alexei Znamensky <[email protected]>
@russoz russoz deleted the apache2-mod-proxy-revamp-4 branch January 24, 2025 00:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-10 Automatically create a backport for the stable-10 branch module module plugins plugin (any type)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants