-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
> syncPackage 同步时,由于任务并发,可能会导致同步过程中 versions 表记录已经创建,pkg.manifests 还没有同步 > 针对这种场景做补偿逻辑,防止 tag 打在一个 pkg.manifests 没有的版本里 * 修改 pkg.manifests 补偿逻辑,兼容有 versions 没 pkg.manifests 的情况 * 添加 eventCork 的 advice,在 syncPackage 任务结束后,再统一触发 changes,依赖 [ref](eggjs/tegg#60) 在同步和被同步的场景,确保 changes 发出时,pkg.manifests 已经更新 统一 ctx 内不同 changes 时序可能影响,不影响重新读取 manifests 一致性
- Loading branch information
Showing
4 changed files
with
157 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { ContextEventBus, Inject } from '@eggjs/tegg'; | ||
import { Advice, IAdvice } from '@eggjs/tegg/aop'; | ||
|
||
@Advice() | ||
export class EventCorkAdvice implements IAdvice { | ||
@Inject() | ||
private eventBus: ContextEventBus; | ||
|
||
async beforeCall() { | ||
this.eventBus.cork(); | ||
} | ||
|
||
async afterFinally() { | ||
this.eventBus.uncork(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.