cluster环境下对sub的判断有点问题

This commit is contained in:
Xu Chang 2025-05-08 13:21:21 +08:00
parent a58ef9107e
commit 9d1b61e69a
2 changed files with 6 additions and 4 deletions

View File

@ -126,8 +126,9 @@ class ClusterAppLoader extends AppLoader_1.AppLoader {
(0, assert_1.default)(!(cs && singleton));
if (when === 'commit') {
(0, assert_1.default)(!this.commitTriggers[name], `命名为${name}的trigger出现了多次请检查`);
this.commitTriggers[name] = !!cs;
if (cs || singleton && (0, env_1.getClusterInfo)().instanceId === 0) {
const needSub = !!(cs || singleton && (0, env_1.getClusterInfo)().instanceId === 0);
this.commitTriggers[name] = needSub;
if (needSub) {
this.sub(name);
}
}

View File

@ -138,8 +138,9 @@ export class ClusterAppLoader<ED extends EntityDict & BaseEntityDict, Cxt extend
assert(!(cs && singleton));
if (when === 'commit') {
assert(!this.commitTriggers[name], `命名为${name}的trigger出现了多次请检查`);
this.commitTriggers[name] = !!cs;
if (cs || singleton && getClusterInfo().instanceId === 0) {
const needSub = !!(cs || singleton && getClusterInfo().instanceId === 0);
this.commitTriggers[name] = needSub;
if (needSub) {
this.sub(name);
}
}