corebasic 1.0.91 → 1.0.93

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.
Files changed (2) hide show
  1. package/libs/features.js +6 -4
  2. package/package.json +1 -1
package/libs/features.js CHANGED
@@ -35,20 +35,22 @@ export const send = async (feature, params, payload, headers) => {
35
35
  return (await axios[method](`${service}${url}`, { data: payload, headers: {jwt: headers.jwt}, timeout: 1000 })).data
36
36
  }
37
37
 
38
+ let appids = {}
38
39
  async function announce() {
39
40
  let exp_features = {}
40
41
  for (let [key, {api}] of Object.entries(features))
41
42
  exp_features[key] = {api, service: SERVICE_ADDRESS}
42
43
 
43
- await Messaging.subscribe("SLYP_FEATURES_LIST", async (message, channel) => {
44
+ await Messaging.subscribe(`${process.env.REDIS_CHANNEL_PREFIX}_SLYP_FEATURES_LIST`, async (message, channel) => {
44
45
  let msg = JSON.parse(message)
45
- if (msg.uid !== appId) {
46
+ if (msg.uid !== appId && !appids[msg.uid]) {
47
+ appids[msg.uid] = true
46
48
  SLYP_FEATURES_LIST = {...SLYP_FEATURES_LIST, ...msg}
47
49
  delete SLYP_FEATURES_LIST.uid
48
- await Messaging.produce("SLYP_FEATURES_LIST", JSON.stringify({...exp_features, uid: appId }))
50
+ await Messaging.produce(`${process.env.REDIS_CHANNEL_PREFIX}_SLYP_FEATURES_LIST`, JSON.stringify({...exp_features, uid: appId }))
49
51
  }
50
52
  })
51
- await Messaging.produce("SLYP_FEATURES_LIST", JSON.stringify({...exp_features, uid: appId }))
53
+ await Messaging.produce(`${process.env.REDIS_CHANNEL_PREFIX}_SLYP_FEATURES_LIST`, JSON.stringify({...exp_features, uid: appId }))
52
54
  }
53
55
 
54
56
  export const start = async (app, url, file) => {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "corebasic",
3
3
  "type": "module",
4
- "version": "1.0.91",
4
+ "version": "1.0.93",
5
5
  "description": "",
6
6
  "main": "index.js",
7
7
  "scripts": {