hypha-rpc 0.20.51 → 0.20.53-post-1
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/.pytest_cache/README.md +8 -0
- package/dist/hypha-rpc-websocket.js +48 -9
- package/dist/hypha-rpc-websocket.js.map +1 -1
- package/dist/hypha-rpc-websocket.min.js +1 -1
- package/dist/hypha-rpc-websocket.min.js.map +1 -1
- package/dist/hypha-rpc-websocket.min.mjs +1 -1
- package/dist/hypha-rpc-websocket.min.mjs.map +1 -1
- package/dist/hypha-rpc-websocket.mjs +48 -9
- package/dist/hypha-rpc-websocket.mjs.map +1 -1
- package/package.json +1 -1
- package/report.html +39 -0
- package/src/rpc.js +34 -7
- package/src/websocket-client.js +14 -2
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# pytest cache directory #
|
|
2
|
+
|
|
3
|
+
This directory contains data from the pytest's cache plugin,
|
|
4
|
+
which provides the `--lf` and `--ff` options, as well as the `cache` fixture.
|
|
5
|
+
|
|
6
|
+
**Do not** commit this to version control.
|
|
7
|
+
|
|
8
|
+
See [the docs](https://docs.pytest.org/en/stable/how-to/cache.html) for more information.
|
|
@@ -355,13 +355,40 @@ class RPC extends _utils__WEBPACK_IMPORTED_MODULE_0__.MessageEmitter {
|
|
|
355
355
|
const onConnected = async (connectionInfo) => {
|
|
356
356
|
if (!this._silent && this._connection.manager_id) {
|
|
357
357
|
console.debug("Connection established, reporting services...");
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
const
|
|
364
|
-
|
|
358
|
+
try {
|
|
359
|
+
const manager = await this.get_manager_service({
|
|
360
|
+
timeout: 10,
|
|
361
|
+
case_conversion: "camel",
|
|
362
|
+
});
|
|
363
|
+
const services = Object.values(this._services);
|
|
364
|
+
const servicesCount = services.length;
|
|
365
|
+
let registeredCount = 0;
|
|
366
|
+
|
|
367
|
+
for (let service of services) {
|
|
368
|
+
try {
|
|
369
|
+
const serviceInfo = this._extract_service_info(service);
|
|
370
|
+
await manager.registerService(serviceInfo);
|
|
371
|
+
registeredCount++;
|
|
372
|
+
} catch (serviceError) {
|
|
373
|
+
console.error(
|
|
374
|
+
`Failed to register service ${service.id || "unknown"}: ${serviceError}`,
|
|
375
|
+
);
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
if (registeredCount === servicesCount) {
|
|
380
|
+
console.info(
|
|
381
|
+
`Successfully registered all ${registeredCount} services with the server`,
|
|
382
|
+
);
|
|
383
|
+
} else {
|
|
384
|
+
console.warn(
|
|
385
|
+
`Only registered ${registeredCount} out of ${servicesCount} services with the server`,
|
|
386
|
+
);
|
|
387
|
+
}
|
|
388
|
+
} catch (managerError) {
|
|
389
|
+
console.error(
|
|
390
|
+
`Failed to get manager service for registering services: ${managerError}`,
|
|
391
|
+
);
|
|
365
392
|
}
|
|
366
393
|
} else {
|
|
367
394
|
// console.debug("Connection established", connectionInfo);
|
|
@@ -5168,7 +5195,14 @@ class WebsocketRPCConnection {
|
|
|
5168
5195
|
console.warn(
|
|
5169
5196
|
`Reconnecting to ${this._server_url.split("?")[0]} (attempt #${retry})`,
|
|
5170
5197
|
);
|
|
5198
|
+
// Open the connection, this will trigger the on_connected callback
|
|
5171
5199
|
await this.open();
|
|
5200
|
+
|
|
5201
|
+
// Wait a short time for services to be registered
|
|
5202
|
+
// This gives time for the on_connected callback to complete
|
|
5203
|
+
// which includes re-registering all services to the server
|
|
5204
|
+
await new Promise((resolve) => setTimeout(resolve, 500));
|
|
5205
|
+
|
|
5172
5206
|
// Resend last message if there was one
|
|
5173
5207
|
if (this._last_message) {
|
|
5174
5208
|
console.info("Resending last message after reconnection");
|
|
@@ -5176,7 +5210,7 @@ class WebsocketRPCConnection {
|
|
|
5176
5210
|
this._last_message = null;
|
|
5177
5211
|
}
|
|
5178
5212
|
console.warn(
|
|
5179
|
-
`Successfully reconnected to server ${this._server_url}`,
|
|
5213
|
+
`Successfully reconnected to server ${this._server_url} (services re-registered)`,
|
|
5180
5214
|
);
|
|
5181
5215
|
} catch (e) {
|
|
5182
5216
|
if (`${e}`.includes("ConnectionAbortedError:")) {
|
|
@@ -5232,7 +5266,12 @@ class WebsocketRPCConnection {
|
|
|
5232
5266
|
disconnect(reason) {
|
|
5233
5267
|
this._closed = true;
|
|
5234
5268
|
this._last_message = null; // Clear last message on disconnect
|
|
5235
|
-
if
|
|
5269
|
+
// Ensure websocket is closed if it exists and is not already closed or closing
|
|
5270
|
+
if (
|
|
5271
|
+
this._websocket &&
|
|
5272
|
+
this._websocket.readyState !== WebSocket.CLOSED &&
|
|
5273
|
+
this._websocket.readyState !== WebSocket.CLOSING
|
|
5274
|
+
) {
|
|
5236
5275
|
this._websocket.close(1000, reason);
|
|
5237
5276
|
}
|
|
5238
5277
|
if (this._refresh_token_task) {
|