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: reduce the number of failures due to conflict post update #5604
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5604 +/- ##
============================================
- Coverage 56.91% 56.48% -0.43%
- Complexity 3319 3320 +1
============================================
Files 587 595 +8
Lines 18968 19250 +282
Branches 1401 1357 -44
============================================
+ Hits 10795 10874 +79
- Misses 7594 7814 +220
+ Partials 579 562 -17 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @guqing ,
建议不在 run.halo.app.content.impl.PostServiceImpl#updatePost
中实现 retry 逻辑。因为改方法的 post 参数已经传递过来了,重试 n 次都不会有效果。
推荐在
实现。在这里,可以重新拿到最新的文章数据,并重试整个流程。
本次修改,我并没有在 updatePost 中方法中写重试啊,你说的是哪里呢 |
在 run.halo.app.content.impl.PostServiceImpl#updatePost 中 retry 的源码如下所示: halo/application/src/main/java/run/halo/app/content/impl/PostServiceImpl.java Lines 233 to 234 in 2011435
另外,这里不推荐强制修改 post 数据。 |
这个代码并不是在本次修改中添加的,你是建议我在此 PR 中移除它吗 |
有什么好的办法吗,前端传过来的参数是 Post 我无法确定要修改哪些部分,这是在后端无法知晓的总会被覆盖,并且我认为这里强制更新对文章应该没有影响,该覆盖的还是会被覆盖只要数据最终是一致的 |
application/src/main/java/run/halo/app/content/AbstractContentService.java
Show resolved
Hide resolved
Quality Gate passedIssues Measures |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
[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 |
What type of PR is this?
/kind improvement
/area core
/milestone 2.14.x
What this PR does / why we need it:
减少文章更新因版本号冲突而失败的次数
Which issue(s) this PR fixes:
Fixes #5579
Does this PR introduce a user-facing change?