hypha-rpc 0.20.77 → 0.20.78
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/hypha-rpc-websocket.js +28 -7
- 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 +28 -7
- package/dist/hypha-rpc-websocket.mjs.map +1 -1
- package/package.json +1 -1
- package/src/rpc.js +28 -7
- package/server_debug.log +0 -75
|
@@ -966,7 +966,14 @@ class RPC extends _utils_index_js__WEBPACK_IMPORTED_MODULE_0__.MessageEmitter {
|
|
|
966
966
|
config.workspace =
|
|
967
967
|
config.workspace || this._local_workspace || this._connection.workspace;
|
|
968
968
|
const skipContext = config.require_context;
|
|
969
|
-
const
|
|
969
|
+
const excludeKeys = ["id", "config", "name", "description", "type", "docs", "app_id", "service_schema"]
|
|
970
|
+
const filteredService = {};
|
|
971
|
+
for (const key of Object.keys(service)) {
|
|
972
|
+
if (!excludeKeys.includes(key)) {
|
|
973
|
+
filteredService[key] = service[key];
|
|
974
|
+
}
|
|
975
|
+
}
|
|
976
|
+
const serviceSchema = _get_schema(filteredService, null, skipContext);
|
|
970
977
|
const serviceInfo = {
|
|
971
978
|
config: config,
|
|
972
979
|
id: `${config.workspace}/${this._client_id}:${service["id"]}`,
|
|
@@ -1645,10 +1652,24 @@ class RPC extends _utils_index_js__WEBPACK_IMPORTED_MODULE_0__.MessageEmitter {
|
|
|
1645
1652
|
// I.e. the session id won't be passed for promises themselves
|
|
1646
1653
|
main_message["session"] = local_session_id;
|
|
1647
1654
|
let method_name = `${target_id}:${method_id}`;
|
|
1655
|
+
|
|
1656
|
+
// Create a timer that gets reset by heartbeat
|
|
1657
|
+
// Methods can run indefinitely as long as heartbeat keeps resetting the timer
|
|
1658
|
+
// IMPORTANT: When timeout occurs, we must clean up the session to prevent memory leaks
|
|
1659
|
+
const timeoutCallback = function(error_msg) {
|
|
1660
|
+
// First reject the promise
|
|
1661
|
+
reject(error_msg);
|
|
1662
|
+
// Then clean up the entire session to stop all callbacks
|
|
1663
|
+
if (self._object_store[local_session_id]) {
|
|
1664
|
+
delete self._object_store[local_session_id];
|
|
1665
|
+
console.debug(`Cleaned up session ${local_session_id} after timeout`);
|
|
1666
|
+
}
|
|
1667
|
+
};
|
|
1668
|
+
|
|
1648
1669
|
timer = new Timer(
|
|
1649
1670
|
self._method_timeout,
|
|
1650
|
-
|
|
1651
|
-
[`Method call
|
|
1671
|
+
timeoutCallback,
|
|
1672
|
+
[`Method call timed out: ${method_name}, context: ${description}`],
|
|
1652
1673
|
method_name,
|
|
1653
1674
|
);
|
|
1654
1675
|
// By default, hypha will clear the session after the method is called
|
|
@@ -1705,8 +1726,8 @@ class RPC extends _utils_index_js__WEBPACK_IMPORTED_MODULE_0__.MessageEmitter {
|
|
|
1705
1726
|
._emit_message(message_package)
|
|
1706
1727
|
.then(function () {
|
|
1707
1728
|
if (timer) {
|
|
1708
|
-
//
|
|
1709
|
-
timer.
|
|
1729
|
+
// Start the timer after message is sent successfully
|
|
1730
|
+
timer.start();
|
|
1710
1731
|
}
|
|
1711
1732
|
})
|
|
1712
1733
|
.catch(function (err) {
|
|
@@ -1727,8 +1748,8 @@ class RPC extends _utils_index_js__WEBPACK_IMPORTED_MODULE_0__.MessageEmitter {
|
|
|
1727
1748
|
._send_chunks(message_package, target_id, remote_parent)
|
|
1728
1749
|
.then(function () {
|
|
1729
1750
|
if (timer) {
|
|
1730
|
-
//
|
|
1731
|
-
timer.
|
|
1751
|
+
// Start the timer after message is sent successfully
|
|
1752
|
+
timer.start();
|
|
1732
1753
|
}
|
|
1733
1754
|
})
|
|
1734
1755
|
.catch(function (err) {
|