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

Fix _replace_builtin #107

Merged
merged 4 commits into from
Dec 19, 2024
Merged

Fix _replace_builtin #107

merged 4 commits into from
Dec 19, 2024

Conversation

Gallaecio
Copy link
Contributor

@Gallaecio Gallaecio commented Dec 19, 2024

_replace_builtin is meant to find a component, disable it, and replace it by another with the same priority value.

However, due to a variable typo I probably made myself, this function was failing to see built-in components (those in the *_BASE settings), so they were never disabled, causing the built-in offsite middleware to remain enabled, which in turn caused offsite request to be ignored even if allowed through meta (that only our custom middleware takes into account).

@PyExplorer
Copy link
Contributor

@Gallaecio could you please add a link (or short note) to the issue that this fix is going to fix?

@Gallaecio
Copy link
Contributor Author

PR description added.

Comment on lines 73 to +75
MaxRequestsPerSeedDownloaderMiddleware: 100,
OffsiteMiddleware: None,
AllowOffsiteMiddleware: 500,
BUILTIN_OFFSITE_MIDDLEWARE_IMPORT_PATH: None,
AllowOffsiteMiddleware: 50,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

As far as I can see from the code, this change in order (the offsite middleware will now come before the max-requests-per-seed middleware) is OK, probably even for the best. I hope it does not come back to bite me…

Copy link
Contributor

Choose a reason for hiding this comment

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

:) It's interesting as all tests for the addon passed - might be this case was not covered :(

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The add-on was injecting the built-in middleware manually (the lines removed) before calling _replace_builtin, that’s why it was not caught by the tests.

@Gallaecio Gallaecio merged commit 34f1c44 into zytedata:main Dec 19, 2024
10 checks passed
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.

3 participants