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

refactor: enhance cache management in plugin setting config #6141

Merged
merged 3 commits into from
Jun 26, 2024

Conversation

guqing
Copy link
Member

@guqing guqing commented Jun 25, 2024

What type of PR is this?

/kind feature
/area plugin
/area core
/milestone 2.17.x

What this PR does / why we need it:

增强插件配置的缓存管理

  1. 通过 SettingFetcher/ReactiveSettingFetcher 获取插件配置可以不在考虑获取数据的性能问题,当数据变更后会自动更新缓存
  2. 现在你可以通过在插件中监听 PluginConfigUpdatedEvent 事件来做一些处理,它会在用户更改插件配置后被触发

Does this PR introduce a user-facing change?

增强插件配置的缓存管理并支持通过监听 `PluginConfigUpdatedEvent` 事件做一些特殊处理

@f2c-ci-robot f2c-ci-robot bot added kind/feature Categorizes issue or PR as related to a new feature. release-note Denotes a PR that will be considered when it comes time to generate release notes. labels Jun 25, 2024
@f2c-ci-robot f2c-ci-robot bot added this to the 2.17.x milestone Jun 25, 2024
@f2c-ci-robot f2c-ci-robot bot added the area/plugin Issues or PRs related to the Plugin Provider label Jun 25, 2024
@f2c-ci-robot f2c-ci-robot bot requested review from JohnNiang and wan92hen June 25, 2024 10:56
@f2c-ci-robot f2c-ci-robot bot added the area/core Issues or PRs related to the Halo Core label Jun 25, 2024
Copy link

codecov bot commented Jun 25, 2024

Codecov Report

Attention: Patch coverage is 56.38298% with 41 lines in your changes missing coverage. Please review.

Project coverage is 55.08%. Comparing base (5fdf6c0) to head (f4ae7ab).
Report is 274 commits behind head on main.

Files Patch % Lines
...halo/app/plugin/DefaultReactiveSettingFetcher.java 71.87% 14 Missing and 4 partials ⚠️
.../run/halo/app/plugin/PluginConfigUpdatedEvent.java 0.00% 7 Missing ⚠️
.../java/run/halo/app/plugin/SpringPluginFactory.java 22.22% 7 Missing ⚠️
.../java/run/halo/app/plugin/DefaultPluginGetter.java 20.00% 4 Missing ⚠️
...plugin/DefaultPluginApplicationContextFactory.java 0.00% 3 Missing ⚠️
...c/main/java/run/halo/app/plugin/PluginContext.java 0.00% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #6141      +/-   ##
============================================
- Coverage     56.91%   55.08%   -1.83%     
- Complexity     3319     3501     +182     
============================================
  Files           587      636      +49     
  Lines         18968    21456    +2488     
  Branches       1401     1501     +100     
============================================
+ Hits          10795    11819    +1024     
- Misses         7594     9029    +1435     
- Partials        579      608      +29     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@JohnNiang JohnNiang left a comment

Choose a reason for hiding this comment

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

/lgtm

@f2c-ci-robot f2c-ci-robot bot added the lgtm Indicates that a PR is ready to be merged. label Jun 26, 2024
Copy link

f2c-ci-robot bot commented Jun 26, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: JohnNiang

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@f2c-ci-robot f2c-ci-robot bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 26, 2024
@guqing guqing added the sig/docs Categorizes an issue or PR as relevant to SIG Docs. label Jun 26, 2024
@f2c-ci-robot f2c-ci-robot bot merged commit 68d428a into halo-dev:main Jun 26, 2024
7 checks passed
@guqing guqing deleted the feature/cache-plugin-config branch June 26, 2024 11:21
@ruibaby ruibaby modified the milestones: 2.17.x, 2.17.0 Jun 26, 2024
f2c-ci-robot bot pushed a commit that referenced this pull request Jun 26, 2024
…plugin (#6156)

#### What type of PR is this?

/kind bug
/area core
/area plugin

#### What this PR does / why we need it:

The problem was introduced by PR <#6141>. That PR wrongly registered `settingFetcher` singleton bean.

#### Which issue(s) this PR fixes:

<img width="1920" alt="image" src="https://github.com/halo-dev/halo/assets/16865714/ecc67064-3506-49b8-8114-a145da549126">

#### Does this PR introduce a user-facing change?

```release-note
None
```
f2c-ci-robot bot pushed a commit to halo-dev/docs that referenced this pull request Jun 28, 2024
### What this PR does?
新增关于如何使用插件配置的文档

see also halo-dev/halo#6141

```release-note
None
```
f2c-ci-robot bot pushed a commit that referenced this pull request Jun 30, 2024
)

#### What type of PR is this?

/kind bug
/area core
/area plugin
/milestone 2.17.x

#### What this PR does / why we need it:

This PR  makes sure the method `cache#put` is called before the event is published to avoid the event listener to fetch the old value from the cache.

The problem was introduced by <#6141>.

#### Which issue(s) this PR fixes:

Fixes #6213 

#### Does this PR introduce a user-facing change?

```release-note
修复在插件配置变更监听器中始终获取到旧数据的问题
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/core Issues or PRs related to the Halo Core area/plugin Issues or PRs related to the Plugin Provider kind/feature Categorizes issue or PR as related to a new feature. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/docs Categorizes an issue or PR as relevant to SIG Docs.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants