Skip to content

[type: refactor] refactor abstractshenyuplugin#execute#4178

Merged
yu199195 merged 17 commits intoapache:masterfrom
847850277:refactor_abstractshenyuplugin#execute
Nov 16, 2022
Merged

[type: refactor] refactor abstractshenyuplugin#execute#4178
yu199195 merged 17 commits intoapache:masterfrom
847850277:refactor_abstractshenyuplugin#execute

Conversation

@847850277
Copy link
Contributor

Make sure that:

  • You have read the contribution guidelines.
  • You submit test cases (unit or integration tests) that back your changes.
  • Your local test passed ./mvnw clean install -Dmaven.javadoc.skip=true.

@codecov-commenter
Copy link

codecov-commenter commented Nov 12, 2022

Codecov Report

Merging #4178 (f913be7) into master (7bf7e6f) will decrease coverage by 0.39%.
The diff coverage is 57.69%.

@@             Coverage Diff              @@
##             master    #4178      +/-   ##
============================================
- Coverage     70.52%   70.12%   -0.40%     
+ Complexity     7229     7171      -58     
============================================
  Files           969      969              
  Lines         27032    27023       -9     
  Branches       2405     2404       -1     
============================================
- Hits          19065    18951     -114     
- Misses         6511     6610      +99     
- Partials       1456     1462       +6     
Impacted Files Coverage Δ
...pache/shenyu/plugin/base/AbstractShenyuPlugin.java 39.55% <56.86%> (+0.74%) ⬆️
...in/java/org/apache/shenyu/spi/ExtensionLoader.java 86.58% <100.00%> (ø)
...henyu/plugin/grpc/resolver/ShenyuNameResolver.java 54.25% <0.00%> (-18.09%) ⬇️
...he/shenyu/common/timer/HierarchicalWheelTimer.java 68.00% <0.00%> (-18.00%) ⬇️
...va/org/apache/shenyu/common/timer/TimingWheel.java 73.80% <0.00%> (-16.67%) ⬇️
...ava/org/apache/shenyu/admin/utils/SessionUtil.java 78.94% <0.00%> (-15.79%) ⬇️
...ache/shenyu/plugin/grpc/cache/GrpcClientCache.java 87.50% <0.00%> (-12.50%) ⬇️
...a/org/apache/shenyu/common/utils/VersionUtils.java 35.71% <0.00%> (-10.72%) ⬇️
.../org/apache/shenyu/common/timer/TimerTaskList.java 74.72% <0.00%> (-8.80%) ⬇️
...henyu/common/cache/MemorySafeWindowTinyLFUMap.java 73.33% <0.00%> (-8.34%) ⬇️
... and 46 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

} else {
if (StringUtils.isBlank(selectorData.getId())) {
return handleSelectorIfNull(pluginName, exchange, chain);
if (matchCacheConfig.getSelectorEnabled() && matchSelectorData.getLeft()) {
Copy link
Member

Choose a reason for hiding this comment

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

other alreay cache, if StringUtils.isBlank(selectorData.getId(), mybe return~

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Preprocessing then returns.

image

List<SelectorData> selectors = BaseDataCache.getInstance().obtainSelectorData(pluginName);
SelectorData selectorData = obtainSelectorDataCacheIfEnabled(path);
// early exit
if (Objects.isNull(pluginData) || !pluginData.getEnabled()) {
Copy link
Member

Choose a reason for hiding this comment

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

if (Objects.isNull(pluginData) || !pluginData.getEnabled())

maybe like this :

PluginData pluginData = BaseDataCache.getInstance().obtainPluginData(pluginName);
if (Objects.isNull(pluginData) || !pluginData.getEnabled())

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed it

@yu199195 yu199195 added this to the 2.5.1 milestone Nov 16, 2022
} else {
if (StringUtils.isBlank(selectorData.getId())) {
return handleSelectorIfNull(pluginName, exchange, chain);
if (matchCacheConfig.getSelectorEnabled() && matchSelectorData.getLeft()) {
Copy link
Member

Choose a reason for hiding this comment

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

alreay cache,not again cache

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is from From the old logic, seem No duplicate cache appears

image

image

@yu199195 yu199195 merged commit ea85bb5 into apache:master Nov 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants