@xuda.io/xuda-worker-bundle-min 1.3.595 → 1.3.597

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.
Files changed (2) hide show
  1. package/index.js +25 -2
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1535,12 +1535,35 @@ func.datasource.create = async function (
1535
1535
  }
1536
1536
 
1537
1537
  const set_stat_idle = async function () {
1538
+ let ds_connected = [];
1539
+ for (const [dsP, _ds] of Object.entries(_session.DS_GLB)) {
1540
+ if (_ds.parentDataSourceNo == dsSessionP) {
1541
+ ds_connected.push(dsP);
1542
+ }
1543
+ }
1544
+
1538
1545
  var datasource_changes = {
1539
1546
  [dsSessionP]: {
1540
- ["datasource_main"]: { stat: "idle" },
1547
+ ["datasource_main"]: { stat: "idle", stat_ts: Date.now() },
1541
1548
  },
1542
1549
  };
1543
- await func.datasource.update(SESSION_ID, datasource_changes);
1550
+
1551
+ if (!ds_connected.length) {
1552
+ return await func.datasource.update(SESSION_ID, datasource_changes);
1553
+ }
1554
+
1555
+ let interval = setInterval(() => {
1556
+ let idle_count = 0;
1557
+ for (const _ds of ds_connected) {
1558
+ if (_ds.stat == "idle") {
1559
+ idle_count++;
1560
+ }
1561
+ }
1562
+ if (ds_connected.length === idle_count) {
1563
+ clearInterval(interval);
1564
+ func.datasource.update(SESSION_ID, datasource_changes);
1565
+ }
1566
+ }, 1000);
1544
1567
  };
1545
1568
 
1546
1569
  // _ds.stat = "idle";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/xuda-worker-bundle-min",
3
- "version": "1.3.595",
3
+ "version": "1.3.597",
4
4
  "description": "xuda framework min",
5
5
  "main": "index.js",
6
6
  "scripts": {