-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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: provide error instead of nil panic when cache_zone is missing #10138
Merged
Conversation
This file contains 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
Signed-off-by: Ashish Tiwari <[email protected]>
Signed-off-by: Ashish Tiwari <[email protected]>
monkeyDluffy6017
added
the
wait for update
wait for the author's response in this issue/PR
label
Sep 5, 2023
Signed-off-by: Ashish Tiwari <[email protected]>
Signed-off-by: Ashish Tiwari <[email protected]>
Signed-off-by: Ashish Tiwari <[email protected]>
Revolyssup
removed
the
wait for update
wait for the author's response in this issue/PR
label
Sep 5, 2023
kayx23
previously approved these changes
Sep 5, 2023
shreemaan-abhishek
requested changes
Sep 6, 2023
enhance test description Co-authored-by: Abhishek Choudhary <[email protected]>
shreemaan-abhishek
previously approved these changes
Sep 6, 2023
kayx23
previously approved these changes
Sep 6, 2023
Sn0rt
approved these changes
Sep 7, 2023
apisix/plugins/proxy-cache/init.lua
Outdated
@@ -140,6 +141,12 @@ function _M.check_schema(conf) | |||
end | |||
end | |||
|
|||
-- For memory based cache, the default cache_zone cannot be used. | |||
-- cache_zone will also be set as default value in case when passed empty. | |||
if conf.cache_strategy == STRATEGY_MEMORY and conf.cache_zone == DEFAULT_CACHE_ZONE then |
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.
It's not very reliable to judge by cache zone name, i think you could modified like this:
if local_conf.apisix.proxy_cache then
for _, cache in ipairs(local_conf.apisix.proxy_cache.zones) do
if cache.name == conf.cache_zone then
if conf.cache_strategy == STRATEGY_MEMORY and not cache.disk_path then
found = true
break
elseif conf.cache_strategy == STRATEGY_DISK and cache.disk_path then
found = true
break
end
end
end
if found == false then
return false, "cache_zone " .. conf.cache_zone .. " not found"
end
end
monkeyDluffy6017
added
the
wait for update
wait for the author's response in this issue/PR
label
Sep 12, 2023
Signed-off-by: Ashish Tiwari <[email protected]>
Signed-off-by: Ashish Tiwari <[email protected]>
Revolyssup
dismissed stale reviews from kayx23 and shreemaan-abhishek
via
September 13, 2023 04:39
c76dfe5
Revolyssup
removed
the
wait for update
wait for the author's response in this issue/PR
label
Sep 13, 2023
@monkeyDluffy6017 I added a slightly modified version of your suggestion with comments. Please review. |
monkeyDluffy6017
approved these changes
Sep 13, 2023
leslie-tsang
approved these changes
Sep 13, 2023
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.
Description
Fixes #9957
Checklist