@hile/micro 2.0.2 → 2.0.4

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.
@@ -94,6 +94,7 @@ export class Application extends Server {
94
94
  clearTimeout(this.reconnectTimeout);
95
95
  this.reconnectTimeout = undefined;
96
96
  }
97
+ this.registry?.dispose();
97
98
  this.registry = undefined;
98
99
  await callback();
99
100
  };
package/dist/registry.js CHANGED
@@ -63,15 +63,12 @@ export class Registry extends Server {
63
63
  });
64
64
  this.events.on('disconnect', (client, extras) => {
65
65
  const key = client.host + ':' + client.port;
66
- // 清理 topic 中的关联
67
- for (const [topic, { publishers, subscribers }] of this.topics) {
66
+ // 清理 topic 中的关联(不删除 topic,保留 data 供后续 subscriber 使用)
67
+ for (const [, { publishers, subscribers }] of this.topics) {
68
68
  if (publishers.has(key))
69
69
  publishers.delete(key);
70
70
  if (subscribers.has(key))
71
71
  subscribers.delete(key);
72
- if (publishers.size === 0 && subscribers.size === 0) {
73
- this.topics.delete(topic);
74
- }
75
72
  }
76
73
  // 清理 namespace 中的关联
77
74
  const namespace = extras.join('/');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hile/micro",
3
- "version": "2.0.2",
3
+ "version": "2.0.4",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "scripts": {
@@ -24,10 +24,10 @@
24
24
  },
25
25
  "dependencies": {
26
26
  "@hile/message-loader": "^2.0.1",
27
- "@hile/message-ws": "^2.0.2",
27
+ "@hile/message-ws": "^2.0.3",
28
28
  "internal-ip": "^9.0.0",
29
- "ws": "^8.19.0",
29
+ "ws": "^8.21.0",
30
30
  "yaml": "^2.9.0"
31
31
  },
32
- "gitHead": "2c8011db01f2815e5ce34de964d5492640396828"
32
+ "gitHead": "adb7e7814470cef03cb577682f76b530b8af761e"
33
33
  }