@superhero/eventflow-hub 4.7.9 → 4.7.11
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/CHANGELOG.md +12 -0
- package/index.js +2 -12
- package/manager/spokes.js +10 -1
- package/package.json +9 -9
package/CHANGELOG.md
CHANGED
package/index.js
CHANGED
|
@@ -8,8 +8,6 @@ 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
|
-
|
|
13
11
|
export function locate(locator)
|
|
14
12
|
{
|
|
15
13
|
const
|
|
@@ -69,21 +67,13 @@ export default class Hub
|
|
|
69
67
|
{
|
|
70
68
|
const reason = new Error('hub is destroyed')
|
|
71
69
|
reason.code = 'E_EVENTFLOW_HUB_DESTROYED'
|
|
72
|
-
|
|
73
70
|
this.abortion.abort(reason)
|
|
74
|
-
this.server?.close()
|
|
75
71
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
socket.end()
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
this.spokes.destroy()
|
|
72
|
+
this.server?.close()
|
|
73
|
+
await this.spokes.destroy()
|
|
82
74
|
this.subscribers.destroy()
|
|
83
75
|
this.log.warn`destroyed`
|
|
84
76
|
await this.db.updateHubToQuit(this.#hubID)
|
|
85
|
-
await sleep(1e3)
|
|
86
|
-
await this.db.close()
|
|
87
77
|
}
|
|
88
78
|
|
|
89
79
|
#bootstrapServer()
|
package/manager/spokes.js
CHANGED
|
@@ -11,8 +11,17 @@ export default class SpokesManager
|
|
|
11
11
|
return this.#set.size
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
destroy()
|
|
14
|
+
async destroy()
|
|
15
15
|
{
|
|
16
|
+
for(const socket of this.all)
|
|
17
|
+
{
|
|
18
|
+
await new Promise(resolve =>
|
|
19
|
+
{
|
|
20
|
+
socket.once('close', resolve)
|
|
21
|
+
socket.end()
|
|
22
|
+
})
|
|
23
|
+
}
|
|
24
|
+
|
|
16
25
|
this.#set.clear()
|
|
17
26
|
}
|
|
18
27
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superhero/eventflow-hub",
|
|
3
|
-
"version": "4.7.
|
|
3
|
+
"version": "4.7.11",
|
|
4
4
|
"description": "Eventflow hub is the central server component in the eventflow ecosystem.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eventflow",
|
|
@@ -20,17 +20,17 @@
|
|
|
20
20
|
"test": "syntax-check; node --test --test-reporter=@superhero/audit/reporter --experimental-test-coverage"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@superhero/id-name-generator": "4.7.
|
|
24
|
-
"@superhero/log": "4.7.
|
|
25
|
-
"@superhero/eventflow-certificates": "4.7.
|
|
26
|
-
"@superhero/eventflow-db": "4.7.
|
|
27
|
-
"@superhero/tcp-record-channel": "4.7.
|
|
28
|
-
"@superhero/deep": "4.7.
|
|
23
|
+
"@superhero/id-name-generator": "4.7.11",
|
|
24
|
+
"@superhero/log": "4.7.11",
|
|
25
|
+
"@superhero/eventflow-certificates": "4.7.11",
|
|
26
|
+
"@superhero/eventflow-db": "4.7.11",
|
|
27
|
+
"@superhero/tcp-record-channel": "4.7.11",
|
|
28
|
+
"@superhero/deep": "4.7.11"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@superhero/audit": "4.7.
|
|
31
|
+
"@superhero/audit": "4.7.11",
|
|
32
32
|
"@superhero/syntax-check": "0.0.2",
|
|
33
|
-
"@superhero/locator": "4.7.
|
|
33
|
+
"@superhero/locator": "4.7.11"
|
|
34
34
|
},
|
|
35
35
|
"author": {
|
|
36
36
|
"name": "Erik Landvall",
|