@blaxel/core 0.3.11 → 0.3.12-preview.249
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/dist/cjs/.tsbuildinfo +1 -1
- package/dist/cjs/common/h2pool.js +22 -6
- package/dist/cjs/common/settings.js +2 -2
- package/dist/cjs/types/common/h2pool.d.ts +2 -0
- package/dist/cjs-browser/.tsbuildinfo +1 -1
- package/dist/cjs-browser/common/settings.js +2 -2
- package/dist/cjs-browser/types/common/h2pool.d.ts +2 -0
- package/dist/esm/.tsbuildinfo +1 -1
- package/dist/esm/common/h2pool.js +22 -6
- package/dist/esm/common/settings.js +2 -2
- package/dist/esm-browser/.tsbuildinfo +1 -1
- package/dist/esm-browser/common/settings.js +2 -2
- package/package.json +1 -1
|
@@ -11,6 +11,7 @@ const DEFAULT_PING_TIMEOUT_MS = 500;
|
|
|
11
11
|
export class H2Pool {
|
|
12
12
|
sessions = new Map();
|
|
13
13
|
inflight = new Map();
|
|
14
|
+
validations = new Map();
|
|
14
15
|
_establish = null;
|
|
15
16
|
maxIdleMs;
|
|
16
17
|
pingTimeoutMs;
|
|
@@ -84,26 +85,39 @@ export class H2Pool {
|
|
|
84
85
|
return Promise.resolve(false);
|
|
85
86
|
return new Promise((resolve) => {
|
|
86
87
|
let settled = false;
|
|
87
|
-
const finish = (
|
|
88
|
+
const finish = (shouldRetain) => {
|
|
88
89
|
if (settled)
|
|
89
90
|
return;
|
|
90
91
|
settled = true;
|
|
91
92
|
clearTimeout(timer);
|
|
92
|
-
resolve(
|
|
93
|
+
resolve(shouldRetain);
|
|
93
94
|
};
|
|
94
95
|
const timer = setTimeout(() => finish(false), this.pingTimeoutMs);
|
|
95
96
|
try {
|
|
96
97
|
const sent = session.ping((err) => {
|
|
97
98
|
finish(!err && !this.isClosed(session));
|
|
98
99
|
});
|
|
100
|
+
// `false` means Node did not send the ping, not that the session failed.
|
|
99
101
|
if (!sent)
|
|
100
|
-
finish(
|
|
102
|
+
finish(true);
|
|
101
103
|
}
|
|
102
104
|
catch {
|
|
103
105
|
finish(false);
|
|
104
106
|
}
|
|
105
107
|
});
|
|
106
108
|
}
|
|
109
|
+
validateSession(domain, session) {
|
|
110
|
+
const existing = this.validations.get(domain);
|
|
111
|
+
if (existing?.session === session)
|
|
112
|
+
return existing.promise;
|
|
113
|
+
const promise = this.ping(session).finally(() => {
|
|
114
|
+
if (this.validations.get(domain)?.promise === promise) {
|
|
115
|
+
this.validations.delete(domain);
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
this.validations.set(domain, { session, promise });
|
|
119
|
+
return promise;
|
|
120
|
+
}
|
|
107
121
|
async validateEntry(domain, entry) {
|
|
108
122
|
if (!entry)
|
|
109
123
|
return null;
|
|
@@ -116,9 +130,10 @@ export class H2Pool {
|
|
|
116
130
|
this.markUsed(domain, session);
|
|
117
131
|
return session;
|
|
118
132
|
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
//
|
|
133
|
+
const shouldRetain = await this.validateSession(domain, session);
|
|
134
|
+
if (shouldRetain && !this.isClosed(session)) {
|
|
135
|
+
// ENG-2676 generation/identity pin: validation yields, and during that
|
|
136
|
+
// await an eviction listener (goaway/error/close ->
|
|
122
137
|
// attachEvictionListeners, see above) may have deleted or replaced this
|
|
123
138
|
// entry. `entry` is the exact object held in the map, so if it is no
|
|
124
139
|
// longer the cached generation, refuse the now-stale session instead of
|
|
@@ -219,6 +234,7 @@ export class H2Pool {
|
|
|
219
234
|
}
|
|
220
235
|
this.sessions.clear();
|
|
221
236
|
this.inflight.clear();
|
|
237
|
+
this.validations.clear();
|
|
222
238
|
}
|
|
223
239
|
}
|
|
224
240
|
export const h2Pool = new H2Pool();
|
|
@@ -24,8 +24,8 @@ function missingCredentialsMessage() {
|
|
|
24
24
|
return "No Blaxel credentials found. Set the BL_API_KEY and BL_WORKSPACE environment variables, or run `bl login`.";
|
|
25
25
|
}
|
|
26
26
|
// Build info - these placeholders are replaced at build time by build:replace-imports
|
|
27
|
-
const BUILD_VERSION = "0.3.
|
|
28
|
-
const BUILD_COMMIT = "
|
|
27
|
+
const BUILD_VERSION = "0.3.12-preview.249";
|
|
28
|
+
const BUILD_COMMIT = "e96ab8e355576dcaff88294c9d3098cb8ab20c9f";
|
|
29
29
|
const BUILD_SENTRY_DSN = "https://fd5e60e1c9820e1eef5ccebb84a07127@o4508714045276160.ingest.us.sentry.io/4510465864564736";
|
|
30
30
|
const BLAXEL_API_VERSION = "2026-04-28";
|
|
31
31
|
// Bun < 1.3.11 never sends connection-level WINDOW_UPDATE: the pooled h2
|