@superhero/eventflow-hub 4.0.8 → 4.0.10

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 (3) hide show
  1. package/config.js +1 -2
  2. package/index.js +6 -2
  3. package/package.json +3 -4
package/config.js CHANGED
@@ -6,6 +6,7 @@ export default
6
6
  bootstrap : { '@superhero/eventflow-hub' : true },
7
7
  dependency : { '@superhero/eventflow-db' : true },
8
8
  locator : { '@superhero/eventflow-hub' : true },
9
+ destroy : { '@superhero/eventflow-db' : false },
9
10
  eventflow :
10
11
  {
11
12
  hub:
@@ -19,8 +20,6 @@ export default
19
20
  TCP_SOCKET_SERVER_OPTIONS : process.env.EVENTFLOW_HUB_TCP_SOCKET_SERVER_OPTIONS ?? {},
20
21
  TCP_SOCKET_CLIENT_OPTIONS : process.env.EVENTFLOW_HUB_TCP_SOCKET_CLIENT_OPTIONS ?? {},
21
22
  KEEP_ALIVE_INTERVAL : process.env.EVENTFLOW_HUB_KEEP_ALIVE_INTERVAL ?? 60e3,
22
- PEER_HUB_ONLINE_TIMEOUT : process.env.EVENTFLOW_HUB_PEER_HUB_ONLINE_TIMEOUT ?? 5e3,
23
- SPOKE_ID_MESSAGE_TIMEOUT : process.env.EVENTFLOW_HUB_SPOKE_ID_MESSAGE_TIMEOUT ?? 5e3,
24
23
  SHEDULED_INTERVAL_DELAY : process.env.EVENTFLOW_HUB_SHEDULED_INTERVAL_DELAY ?? 1e3,
25
24
 
26
25
  certificates:
package/index.js CHANGED
@@ -8,6 +8,8 @@ import SubscribersManager from '@superhero/eventflow-hub/manager/subscribers'
8
8
  import CertificatesManager from '@superhero/eventflow-certificates'
9
9
  import { setInterval as asyncInterval } from 'node:timers/promises'
10
10
 
11
+ const sleep = (ms) => new Promise((accept) => setTimeout(accept, ms))
12
+
11
13
  export function locate(locator)
12
14
  {
13
15
  const
@@ -79,7 +81,8 @@ export default class Hub
79
81
  this.subscribers.destroy()
80
82
  this.log.warn`destroyed`
81
83
  await this.db.updateHubToQuit(this.#hubID)
82
- setTimeout(() => this.db.close(), 500)
84
+ await sleep(1e3)
85
+ await this.db.close()
83
86
  }
84
87
 
85
88
  #bootstrapServer()
@@ -350,7 +353,8 @@ export default class Hub
350
353
  dynamicConfig = { servername:hubID, host:ip, port, ca, cert:certChain, key:hubLeaf.key, passphrase:hubLeaf.pass },
351
354
  peerHubConfig = deepmerge(dynamicConfig, this.config.TCP_SOCKET_CLIENT_OPTIONS),
352
355
  peerHub = await this.channel.createTlsClient(peerHubConfig)
353
-
356
+
357
+ this.log.info`peer hub connection established ${peerHub.id}`
354
358
  peerHub.id = peerHub.getPeerCertificate().subject.UID
355
359
  this.channel.transmit(peerHub, [ 'online', this.#hubID, this.config.EXTERNAL_IP, this.config.EXTERNAL_PORT ])
356
360
  this.log.info`broadcasted online status to peer hub ${peerHub.id}`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superhero/eventflow-hub",
3
- "version": "4.0.8",
3
+ "version": "4.0.10",
4
4
  "description": "Eventflow hub is the central server component in the eventflow ecosystem.",
5
5
  "keywords": [
6
6
  "eventflow",
@@ -16,14 +16,13 @@
16
16
  "dependencies": {
17
17
  "@superhero/id-name-generator": "^4.0.0",
18
18
  "@superhero/log": "^4.0.1",
19
- "@superhero/eventflow-certificates": "^4.0.6",
19
+ "@superhero/eventflow-certificates": "^4.0.7",
20
20
  "@superhero/eventflow-db": "^4.2.3",
21
- "@superhero/openssl": "^4.0.3",
22
21
  "@superhero/tcp-record-channel": "^4.2.1",
23
22
  "@superhero/deep": "^4.2.0"
24
23
  },
25
24
  "devDependencies": {
26
- "@superhero/locator": "^4.2.4"
25
+ "@superhero/locator": "^4.2.5"
27
26
  },
28
27
  "scripts": {
29
28
  "test-build": "npm explore @superhero/eventflow-db -- npm run test-build",