fix(ci): resolve webhook IP cache invalidation bug#1063
Open
MrButtCode wants to merge 10 commits intoCCExtractor:masterfrom
Open
fix(ci): resolve webhook IP cache invalidation bug#1063MrButtCode wants to merge 10 commits intoCCExtractor:masterfrom
MrButtCode wants to merge 10 commits intoCCExtractor:masterfrom
Conversation
canihavesomecoffee
requested changes
Mar 15, 2026
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



[FIX] resolve webhook IP cache invalidation bug
In raising this pull request, I confirm the following:
My familiarity with the project is as follows:
Resolves a critical performance bug in the webhook IP validation logic.
In
utility.pythecached_load_timevariable was declared locally strictly insidecache_has_expired(). This caused the timestamp to reset to the 1970 epoch on every single function call. As a result the expiration check always evaluated to True forcing the application to make a syncronous HTTP request to the GitHub API on every incoming webhook instead of using the cached IP blocks.The Fix:
Elevated
cached_load_timeto module level scope and updatedget_cached_web_hook_blocks()to reset the timestamp todatetime.now()only after a successful GitHub API fetch. This restores the intended 1 hour caching behavior.Additionally refactored the caching architecture per maintainer review:
cache_has_expireda pure function that accepts the load time as an explicit argument.BaseTestCasesetUpmethod.This ensures the production code remains completely free of test specific logic while keeping the CI pipeline perfectly stable.