@toa.io/boot 1.0.0-alpha.286 → 1.0.0-alpha.287
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 +10 -0
- package/package.json +6 -6
- package/src/discovery.js +21 -6
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Change Log
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
|
+
|
|
6
|
+
# [1.0.0-alpha.287](https://github.com/toa-io/toa/compare/v1.0.0-alpha.286...v1.0.0-alpha.287) (2026-09-06)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* **boot:** a discovery belongs to the connection that made it ([48e1c8f](https://github.com/toa-io/toa/commit/48e1c8f668b1853134ae9fb2349c485e6da66c28))
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@toa.io/boot",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.287",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Toa Boot",
|
|
6
6
|
"author": "temich <tema.gurtovoy@gmail.com>",
|
|
@@ -21,14 +21,14 @@
|
|
|
21
21
|
"test": "echo \"Error: run tests from root\" && exit 1"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@toa.io/atomicity": "1.0.0-alpha.
|
|
25
|
-
"@toa.io/core": "1.0.0-alpha.
|
|
24
|
+
"@toa.io/atomicity": "1.0.0-alpha.287",
|
|
25
|
+
"@toa.io/core": "1.0.0-alpha.287",
|
|
26
26
|
"@toa.io/generic": "1.0.0-alpha.286",
|
|
27
|
-
"@toa.io/norm": "1.0.0-alpha.
|
|
28
|
-
"@toa.io/schemas": "1.0.0-alpha.
|
|
27
|
+
"@toa.io/norm": "1.0.0-alpha.287",
|
|
28
|
+
"@toa.io/schemas": "1.0.0-alpha.287",
|
|
29
29
|
"clone-deep": "4.0.1",
|
|
30
30
|
"dotenv": "17.4.2",
|
|
31
31
|
"openspan": "1.0.0-alpha.286"
|
|
32
32
|
},
|
|
33
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "5c7944a70c16065ab6372072385cc1f02f5db77c"
|
|
34
34
|
}
|
package/src/discovery.js
CHANGED
|
@@ -5,15 +5,30 @@ import * as boot from './index.js'
|
|
|
5
5
|
let promise
|
|
6
6
|
let instance = null
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* The process's discovery, for as long as it is connected.
|
|
10
|
+
*
|
|
11
|
+
* A disconnected one is replaced rather than reused. A lookup becomes a dependency of the
|
|
12
|
+
* discovery that made it and nothing takes one back, so an instance carried across a
|
|
13
|
+
* disconnection would reconnect every call it has ever made beside the ones the composition now
|
|
14
|
+
* booting asks for — and every disconnection after that would walk all of them again.
|
|
15
|
+
*/
|
|
8
16
|
export const discovery = async () => {
|
|
9
|
-
|
|
10
|
-
instance
|
|
11
|
-
|
|
12
|
-
|
|
17
|
+
while (true) {
|
|
18
|
+
if (instance === null) {
|
|
19
|
+
instance = new Discovery(lookup)
|
|
20
|
+
promise = instance.connect()
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const current = instance
|
|
13
24
|
|
|
14
|
-
|
|
25
|
+
await promise
|
|
15
26
|
|
|
16
|
-
|
|
27
|
+
if (current.connected) return current
|
|
28
|
+
|
|
29
|
+
// whoever replaced it first wins, and the loop reads what they left
|
|
30
|
+
if (instance === current) instance = null
|
|
31
|
+
}
|
|
17
32
|
}
|
|
18
33
|
|
|
19
34
|
const lookup = async (locator) => {
|