diff --git a/lib/ClusterAppLoader.js b/lib/ClusterAppLoader.js index bbb1f62..707839b 100644 --- a/lib/ClusterAppLoader.js +++ b/lib/ClusterAppLoader.js @@ -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); } } diff --git a/src/ClusterAppLoader.ts b/src/ClusterAppLoader.ts index 4cd427f..3b38112 100644 --- a/src/ClusterAppLoader.ts +++ b/src/ClusterAppLoader.ts @@ -138,8 +138,9 @@ export class ClusterAppLoader