-
guqing created a review on pull request #4276 in halo-dev/halo
-
guqing commented on issue #4269 in halo-dev/halo
-
guqing commented on issue #4269 in halo-dev/halo
-
guqing pushed to main in guqing/halo-theme-higan
-
guqing pushed to main in guqing/halo-theme-higan
-
guqing created a review on pull request #25 in halo-sigs/richtext-editor
-
guqing pushed to refactor/4273 in guqing/halo
-
guqing created a review on pull request #24 in halo-sigs/richtext-editor
-
guqing commented on pull request #4274 in halo-dev/halo
-
guqing opened pull request #4275 in halo-dev/halo
What type of PR is this?
/kind improvement
/area core
/area plugin
/milestone 2.7.xWhat this PR does / why we need it:
修复插件启动成功但更新数据失败而导致插件状态不符合预期的问题
how to test it?
- 安装一个带 console 页面的插件并停用它
- 使用 IDEA 在 doStart 方法最后更新数据的地方也就是 https://github.com/halo-dev/halo/blob/834e37cf130f2487fab268c9bc7198555933f0dc/application/src/main/java/run/halo/app/core/extension/reconciler/PluginReconciler.java#L447 处打断点,suspend 勾选为 Thread
- 启用插件,会执行到断点处
- 使用如下命令更新数据将 status 删除以模拟乐观锁冲突并清除 status 状态排除干扰
curl -u admin:admin -X PUT http://localhost:8090/apis/plugin.halo.run/v1alpha1/plugins/{name} --data '替换为 plugin 的 json '
- 放行端点
根据上述步骤先在 main 分支浮现然后在切换到此 PR 对比结果,期望插件的状态为启动成功且 status 数据示例如下:
conditions 有两条会因为乐观锁更新失败一次且entry和stylesheet都有值{ "phase": "STARTED", "conditions": [ { "type": "STARTED", "status": "TRUE", "lastTransitionTime": "2023-07-21T07:46:01.274211Z", "message": "Started successfully", "reason": "STARTED" }, { "type": "FAILED", "status": "FALSE", "lastTransitionTime": "2023-07-21T07:46:01.248001Z", "message": "Failed to update table [extensions]; Version does not match for row with Id [/registry/plugin.halo.run/plugins/PluginBytemd]", "reason": "UnexpectedState" } ], "lastStartTime": "2023-07-21T07:46:01.273625Z", "entry": "/plugins/PluginBytemd/assets/console/main.js?version=1.1.0-SNAPSHOT", "stylesheet": "/plugins/PluginBytemd/assets/console/style.css?version=1.1.0-SNAPSHOT", "logo": "/plugins/PluginBytemd/assets/logo.png?version=1.1.0-SNAPSHOT", "loadLocation": "file:///Users/guqing/Development/halo-sigs/plugin-bytemd/" }
Which issue(s) this PR fixes:
Fixes #4273
Does this PR introduce a user-facing change?
修复插件启动成功但更新数据失败而导致插件状态不符合预期的问题
Which issue(s) this PR fixes:
Fixes #4273
Does this PR introduce a user-facing change?
修复插件启动成功但更新数据失败而导致插件状态不符合预期的问题