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: refresh the plugin wrapper when starting the plugin #4023

Merged
merged 3 commits into from
Jun 14, 2023

Conversation

guqing
Copy link
Member

@guqing guqing commented Jun 1, 2023

What type of PR is this?

/kind improvement
/kind bug
/area core
/area plugin
/milestone 2.6.x

What this PR does / why we need it:

修复插件重启后 MainClass 对象缓存未清除的问题

how to test it?
下载此插件:
plugin-starter-1.0.0-SNAPSHOT.jar.zip

安装并启动插件,会看到类似如下日志:

测试从 [/var/folders/1z/3hlt62691tx63dxx6y0mryw00000gn/T/halo-plugin3709893537121269748.txt] 文件读取内容
插件启动成功!

修改日志中给出的文件的内容后 reload 插件会看到插件启动成功! 后会跟随最新的文件内容则表示 MainClass 是最新的状态没有缓存。

Which issue(s) this PR fixes:

Fixes #4016

Does this PR introduce a user-facing change?

修复插件重启后 MainClass 对象缓存未清除的问题。

@f2c-ci-robot f2c-ci-robot bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/improvement Categorizes issue or PR as related to a improvement. labels Jun 1, 2023
@f2c-ci-robot f2c-ci-robot bot added this to the 2.6.x milestone Jun 1, 2023
@f2c-ci-robot f2c-ci-robot bot added kind/bug Categorizes issue or PR as related to a bug. area/core Issues or PRs related to the Halo Core area/plugin Issues or PRs related to the Plugin Provider labels Jun 1, 2023
@f2c-ci-robot f2c-ci-robot bot requested review from LIlGG and wan92hen June 1, 2023 04:11
@codecov
Copy link

codecov bot commented Jun 1, 2023

Codecov Report

Merging #4023 (0f3180f) into main (a56d4f2) will increase coverage by 0.08%.
The diff coverage is 12.50%.

@@             Coverage Diff              @@
##               main    #4023      +/-   ##
============================================
+ Coverage     60.52%   60.60%   +0.08%     
- Complexity     2380     2385       +5     
============================================
  Files           356      356              
  Lines         12317    12328      +11     
  Branches        891      891              
============================================
+ Hits           7455     7472      +17     
+ Misses         4422     4415       -7     
- Partials        440      441       +1     
Impacted Files Coverage Δ
...in/java/run/halo/app/plugin/BasePluginFactory.java 11.76% <0.00%> (ø)
...in/java/run/halo/app/plugin/HaloPluginManager.java 6.82% <0.00%> (-0.43%) ⬇️
...pp/core/extension/reconciler/PluginReconciler.java 53.14% <100.00%> (-0.11%) ⬇️

... and 5 files with indirect coverage changes

@halo-dev halo-dev deleted a comment from f2c-ci-robot bot Jun 5, 2023
Copy link
Member

@ruibaby ruibaby 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 7, 2023
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.

/approve

@f2c-ci-robot
Copy link

f2c-ci-robot bot commented Jun 14, 2023

[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 14, 2023
@f2c-ci-robot f2c-ci-robot bot merged commit 6d251a7 into halo-dev:main Jun 14, 2023
@ruibaby ruibaby modified the milestones: 2.6.x, 2.7.x Jun 14, 2023
@ruibaby
Copy link
Member

ruibaby commented Jun 14, 2023

/cherry-pick release-2.6

@halo-dev-bot
Copy link
Collaborator

@ruibaby: new pull request created: #4078

In response to this:

/cherry-pick release-2.6

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

f2c-ci-robot bot pushed a commit that referenced this pull request Jun 14, 2023
…plugin (#4078)

This is an automated cherry-pick of #4023

/assign ruibaby

```release-note
修复插件重启后 MainClass 对象缓存未清除的问题
```
@ruibaby ruibaby modified the milestones: 2.7.x, 2.7.0 Jun 19, 2023
f2c-ci-robot bot pushed a commit that referenced this pull request Jan 24, 2024
#### What type of PR is this?

/kind improvement
/area core
/milestone 2.12.x

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

This PR reverts changes in PR <#4023>, mainly thanks to PR <#5148>.

We don't need to refresh the plugin wrapper on every startup, because we entirely disable the plugin in plugin manager when disabling plugin at console.

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

Fixes #4016

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

```release-note
None
```
@guqing guqing deleted the refactor/4016 branch July 1, 2024 09:23
f2c-ci-robot bot pushed a commit that referenced this pull request Jul 3, 2024
#### What type of PR is this?
/kind cleanup
/area plugin
/milestone 2.17.x

#### What this PR does / why we need it:
移除 BasePlugin 中已经过时的构造方法

在 2.6.1 版本中将 `BasePlugin(PluginWrapper wrapper)` 标记为过时并使用 `BasePlugin(PluginContext pluginContext)` 代替,现在已经过了很多版本,是时候移除它了。

see also #4023
#### Does this PR introduce a user-facing change?
```release-note
开发者相关:移除 BasePlugin 中已经过时的构造方法
```
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/bug Categorizes issue or PR as related to a bug. kind/improvement Categorizes issue or PR as related to a improvement. 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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

插件重启后 MainClass 中持有的文件内容变更无法生效
4 participants