@abtnode/core 1.16.11-next-3d2b39f7 → 1.16.11-next-09bc31f8

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.
@@ -1446,7 +1446,7 @@ class BlockletManager extends BaseBlockletManager {
1446
1446
  await forEachComponentV2(
1447
1447
  blocklet,
1448
1448
  async (component) => {
1449
- if (!forceSync || !isInProgress(component.status)) {
1449
+ if (!forceSync && !util.shouldUpdateBlockletStatus(component.status)) {
1450
1450
  return;
1451
1451
  }
1452
1452
 
@@ -1457,10 +1457,24 @@ class BlockletManager extends BaseBlockletManager {
1457
1457
  try {
1458
1458
  const status = await getProcessState(component.env.processId);
1459
1459
  if (component.status !== status) {
1460
+ component.status = status;
1460
1461
  await states.blocklet.setBlockletStatus(did, status, { componentDids: [component.meta.did] });
1461
1462
  }
1462
1463
  } catch {
1463
- // do nothing
1464
+ if (
1465
+ ![
1466
+ BlockletStatus.added,
1467
+ BlockletStatus.waiting,
1468
+ BlockletStatus.downloading,
1469
+ BlockletStatus.installing,
1470
+ BlockletStatus.installed,
1471
+ BlockletStatus.upgrading,
1472
+ ].includes(component.status)
1473
+ ) {
1474
+ const status = BlockletStatus.stopped;
1475
+ component.status = status;
1476
+ await states.blocklet.setBlockletStatus(did, status, { componentDids: [component.meta.did] });
1477
+ }
1464
1478
  }
1465
1479
  },
1466
1480
  { parallel: true }
@@ -1535,6 +1549,7 @@ class BlockletManager extends BaseBlockletManager {
1535
1549
  name: 'sync-blocklet-status',
1536
1550
  time: '*/60 * * * * *', // 60s
1537
1551
  fn: this._syncBlockletStatus.bind(this),
1552
+ options: { runOnInit: false },
1538
1553
  },
1539
1554
  {
1540
1555
  name: 'sync-blocklet-list',
package/lib/index.js CHANGED
@@ -266,6 +266,7 @@ function ABTNode(options) {
266
266
  migrateApplicationToStructV2: blockletManager.migrateApplicationToStructV2.bind(blockletManager),
267
267
 
268
268
  // For diagnose purpose
269
+ syncBlockletStatus: blockletManager.status.bind(blockletManager),
269
270
  ensureBlockletIntegrity: blockletManager.ensureBlocklet.bind(blockletManager),
270
271
 
271
272
  getBlocklets: blockletManager.list.bind(blockletManager),
@@ -130,7 +130,10 @@ class BlockletRuntimeMonitor extends EventEmitter {
130
130
  appCpu += runtimeInfo.cpuUsage || 0;
131
131
  appMem += runtimeInfo.memoryUsage || 0;
132
132
  } catch (err) {
133
- this.logger.error('failed to get blocklet runtime info', { processId, error: err });
133
+ // component status in db may not sync with pm2 when server has just started
134
+ if (err.code !== 'BLOCKLET_PROCESS_404') {
135
+ this.logger.error('failed to get blocklet runtime info', { processId, error: err });
136
+ }
134
137
  }
135
138
  } else {
136
139
  delete this.data[blockletDid][componentId];
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.16.11-next-3d2b39f7",
6
+ "version": "1.16.11-next-09bc31f8",
7
7
  "description": "",
8
8
  "main": "lib/index.js",
9
9
  "files": [
@@ -19,18 +19,18 @@
19
19
  "author": "wangshijun <wangshijun2010@gmail.com> (http://github.com/wangshijun)",
20
20
  "license": "Apache-2.0",
21
21
  "dependencies": {
22
- "@abtnode/auth": "1.16.11-next-3d2b39f7",
23
- "@abtnode/certificate-manager": "1.16.11-next-3d2b39f7",
24
- "@abtnode/constant": "1.16.11-next-3d2b39f7",
25
- "@abtnode/cron": "1.16.11-next-3d2b39f7",
26
- "@abtnode/logger": "1.16.11-next-3d2b39f7",
27
- "@abtnode/models": "1.16.11-next-3d2b39f7",
28
- "@abtnode/queue": "1.16.11-next-3d2b39f7",
29
- "@abtnode/rbac": "1.16.11-next-3d2b39f7",
30
- "@abtnode/router-provider": "1.16.11-next-3d2b39f7",
31
- "@abtnode/static-server": "1.16.11-next-3d2b39f7",
32
- "@abtnode/timemachine": "1.16.11-next-3d2b39f7",
33
- "@abtnode/util": "1.16.11-next-3d2b39f7",
22
+ "@abtnode/auth": "1.16.11-next-09bc31f8",
23
+ "@abtnode/certificate-manager": "1.16.11-next-09bc31f8",
24
+ "@abtnode/constant": "1.16.11-next-09bc31f8",
25
+ "@abtnode/cron": "1.16.11-next-09bc31f8",
26
+ "@abtnode/logger": "1.16.11-next-09bc31f8",
27
+ "@abtnode/models": "1.16.11-next-09bc31f8",
28
+ "@abtnode/queue": "1.16.11-next-09bc31f8",
29
+ "@abtnode/rbac": "1.16.11-next-09bc31f8",
30
+ "@abtnode/router-provider": "1.16.11-next-09bc31f8",
31
+ "@abtnode/static-server": "1.16.11-next-09bc31f8",
32
+ "@abtnode/timemachine": "1.16.11-next-09bc31f8",
33
+ "@abtnode/util": "1.16.11-next-09bc31f8",
34
34
  "@arcblock/did": "1.18.80",
35
35
  "@arcblock/did-auth": "1.18.80",
36
36
  "@arcblock/did-ext": "^1.18.80",
@@ -41,9 +41,9 @@
41
41
  "@arcblock/pm2-events": "^0.0.5",
42
42
  "@arcblock/validator": "^1.18.80",
43
43
  "@arcblock/vc": "1.18.80",
44
- "@blocklet/constant": "1.16.11-next-3d2b39f7",
45
- "@blocklet/meta": "1.16.11-next-3d2b39f7",
46
- "@blocklet/sdk": "1.16.11-next-3d2b39f7",
44
+ "@blocklet/constant": "1.16.11-next-09bc31f8",
45
+ "@blocklet/meta": "1.16.11-next-09bc31f8",
46
+ "@blocklet/sdk": "1.16.11-next-09bc31f8",
47
47
  "@did-space/client": "^0.2.112",
48
48
  "@fidm/x509": "^1.2.1",
49
49
  "@ocap/mcrypto": "1.18.80",
@@ -96,5 +96,5 @@
96
96
  "express": "^4.18.2",
97
97
  "jest": "^27.5.1"
98
98
  },
99
- "gitHead": "d0142bd2d1e49b94dcb5542d78e294a7b2258faa"
99
+ "gitHead": "c51355ac77d07dc27e2fb6c44ce2a45432a9469b"
100
100
  }