yu199195 commented on code in PR #4178:
URL: https://github.com/apache/shenyu/pull/4178#discussion_r1021178663
##########
shenyu-plugin/shenyu-plugin-base/src/main/java/org/apache/shenyu/plugin/base/AbstractShenyuPlugin.java:
##########
@@ -79,76 +79,72 @@ public abstract class AbstractShenyuPlugin implements
ShenyuPlugin {
@Override
public Mono<Void> execute(final ServerWebExchange exchange, final
ShenyuPluginChain chain) {
initMatchCacheConfig();
- String pluginName = named();
+ final String pluginName = named();
+ final String path = exchange.getRequest().getURI().getPath();
PluginData pluginData =
BaseDataCache.getInstance().obtainPluginData(pluginName);
- if (Objects.nonNull(pluginData) && pluginData.getEnabled()) {
- final String path = exchange.getRequest().getURI().getPath();
- SelectorData selectorData =
obtainSelectorDataCacheIfEnabled(exchange);
+ List<SelectorData> selectors =
BaseDataCache.getInstance().obtainSelectorData(pluginName);
+ SelectorData selectorData = obtainSelectorDataCacheIfEnabled(path);
+ // early exit
+ if (Objects.isNull(pluginData) || !pluginData.getEnabled()) {
Review Comment:
if (Objects.isNull(pluginData) || !pluginData.getEnabled())
maybe like this :
PluginData pluginData =
BaseDataCache.getInstance().obtainPluginData(pluginName);
if (Objects.isNull(pluginData) || !pluginData.getEnabled())
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]