vona-module-a-broadcast 5.0.21 → 5.0.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +13 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { BeanInfo, BeanBase, BeanSimple, BeanScopeBase, createBeanDecorator } from 'vona';
|
|
1
|
+
import { BeanInfo, BeanBase, getRedisClientKeyPrefix, BeanSimple, BeanScopeBase, createBeanDecorator } from 'vona';
|
|
2
|
+
import { isNil } from '@cabloy/utils';
|
|
2
3
|
import { Service, Scope } from 'vona-module-a-bean';
|
|
3
4
|
|
|
4
5
|
var _dec$1, _dec2$1, _class$1;
|
|
@@ -15,7 +16,7 @@ let ServiceBroadcast = (_dec$1 = Service(), _dec2$1 = BeanInfo({
|
|
|
15
16
|
__init__() {
|
|
16
17
|
const app = this.app;
|
|
17
18
|
this.__callerId = app.bean.worker.id;
|
|
18
|
-
this.__channelName =
|
|
19
|
+
this.__channelName = getRedisClientKeyPrefix('broadcast', this.app);
|
|
19
20
|
this.__pub = app.bean.redis.get('broadcast').duplicate();
|
|
20
21
|
this.__sub = app.bean.redis.get('broadcast').duplicate();
|
|
21
22
|
this.__sub.subscribe(this.__channelName, () => {});
|
|
@@ -43,6 +44,14 @@ let ServiceBroadcast = (_dec$1 = Service(), _dec2$1 = BeanInfo({
|
|
|
43
44
|
// broadcast config
|
|
44
45
|
const broadcastItem = this.bean.onion.broadcast.getOnionSlice(info.broadcastName);
|
|
45
46
|
const broadcastConfig = this.bean.onion.broadcast.getOnionOptions(info.broadcastName);
|
|
47
|
+
// instance
|
|
48
|
+
const instanceName = info.options?.instanceName;
|
|
49
|
+
const instance = broadcastConfig?.instance !== false;
|
|
50
|
+
// check
|
|
51
|
+
if ((!isNil(instanceName) || instance) && !this.app.meta.appReady) {
|
|
52
|
+
// ignore
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
46
55
|
// execute
|
|
47
56
|
return await this.bean.executor.newCtx(async () => {
|
|
48
57
|
const beanFullName = broadcastItem.beanOptions.beanFullName;
|
|
@@ -51,10 +60,10 @@ let ServiceBroadcast = (_dec$1 = Service(), _dec2$1 = BeanInfo({
|
|
|
51
60
|
}, {
|
|
52
61
|
dbInfo: info.options?.dbInfo,
|
|
53
62
|
locale: info.options?.locale,
|
|
54
|
-
instanceName
|
|
63
|
+
instanceName,
|
|
55
64
|
extraData: info.options?.extraData,
|
|
56
65
|
transaction: broadcastConfig?.transaction,
|
|
57
|
-
instance
|
|
66
|
+
instance
|
|
58
67
|
});
|
|
59
68
|
}
|
|
60
69
|
}) || _class$1) || _class$1);
|