@abtnode/core 1.16.29-beta-a3a3b40e → 1.16.29-beta-1fb308f8
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.
|
@@ -19,6 +19,37 @@ function getReleaseDir(blocklet, projectId, releaseId) {
|
|
|
19
19
|
return path.join(projectDir, PROJECT.RELEASE_DIR, `${releaseId}`);
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
const MAX_RETRIES = 5;
|
|
23
|
+
const RETRY_DELAY = 100;
|
|
24
|
+
|
|
25
|
+
// 利用乐观锁, 去更新字段, 如果连续5次都失败, 就算更新失败
|
|
26
|
+
async function updateReleaseWithRetry(releaseState, releaseId, projectId, storeId) {
|
|
27
|
+
// eslint-disable-next-line no-unused-vars
|
|
28
|
+
for (const _ of Array(MAX_RETRIES).fill(0)) {
|
|
29
|
+
// eslint-disable-next-line no-await-in-loop
|
|
30
|
+
const release = await releaseState.findOne({ projectId, id: releaseId });
|
|
31
|
+
release.publishedStoreIds = ensureArray(release.publishedStoreIds);
|
|
32
|
+
release.publishedStoreIds.push(storeId);
|
|
33
|
+
|
|
34
|
+
try {
|
|
35
|
+
// eslint-disable-next-line no-await-in-loop
|
|
36
|
+
const result = await releaseState.update(
|
|
37
|
+
{ id: releaseId, updatedAt: release.updatedAt },
|
|
38
|
+
{ $set: { publishedStoreIds: Array.from(new Set(release.publishedStoreIds)) } }
|
|
39
|
+
);
|
|
40
|
+
if (result?.[0] > 0) {
|
|
41
|
+
return true;
|
|
42
|
+
}
|
|
43
|
+
// eslint-disable-next-line no-await-in-loop
|
|
44
|
+
await new Promise((resolve) => setTimeout(resolve, RETRY_DELAY));
|
|
45
|
+
} catch (error) {
|
|
46
|
+
throw new Error(`Failed to update release: ${error.message}`);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
throw new Error('Failed to update release after maximum retries');
|
|
51
|
+
}
|
|
52
|
+
|
|
22
53
|
const publishToStore = async ({ did, projectId, releaseId, type, storeId, manager }) => {
|
|
23
54
|
if (
|
|
24
55
|
!did ||
|
|
@@ -69,13 +100,7 @@ const publishToStore = async ({ did, projectId, releaseId, type, storeId, manage
|
|
|
69
100
|
source: `Blocklet Studio (${getDisplayName(blocklet)})`,
|
|
70
101
|
});
|
|
71
102
|
|
|
72
|
-
|
|
73
|
-
release.publishedStoreIds.push(storeId);
|
|
74
|
-
|
|
75
|
-
await releaseState.update(
|
|
76
|
-
{ id: releaseId },
|
|
77
|
-
{ $set: { publishedStoreIds: Array.from(new Set(release.publishedStoreIds)) } }
|
|
78
|
-
);
|
|
103
|
+
await updateReleaseWithRetry(releaseState, releaseId, projectId, storeId);
|
|
79
104
|
|
|
80
105
|
return response?.status;
|
|
81
106
|
};
|
|
@@ -11,14 +11,14 @@ const check = async (threshold) => {
|
|
|
11
11
|
for (const disk of disks) {
|
|
12
12
|
const usageRatio = (disk.used / disk.total) * 100;
|
|
13
13
|
if (Number.isNaN(usageRatio)) {
|
|
14
|
-
|
|
14
|
+
continue;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
const usageRatioPercent = `${usageRatio.toFixed(2)}%`;
|
|
18
18
|
logger.info('check disk usage', { usage: usageRatioPercent, threshold });
|
|
19
19
|
|
|
20
20
|
if (usageRatio < threshold) {
|
|
21
|
-
|
|
21
|
+
continue;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
// eslint-disable-next-line no-await-in-loop
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.16.29-beta-
|
|
6
|
+
"version": "1.16.29-beta-1fb308f8",
|
|
7
7
|
"description": "",
|
|
8
8
|
"main": "lib/index.js",
|
|
9
9
|
"files": [
|
|
@@ -19,19 +19,19 @@
|
|
|
19
19
|
"author": "wangshijun <wangshijun2010@gmail.com> (http://github.com/wangshijun)",
|
|
20
20
|
"license": "Apache-2.0",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@abtnode/analytics": "1.16.29-beta-
|
|
23
|
-
"@abtnode/auth": "1.16.29-beta-
|
|
24
|
-
"@abtnode/certificate-manager": "1.16.29-beta-
|
|
25
|
-
"@abtnode/constant": "1.16.29-beta-
|
|
26
|
-
"@abtnode/cron": "1.16.29-beta-
|
|
27
|
-
"@abtnode/logger": "1.16.29-beta-
|
|
28
|
-
"@abtnode/models": "1.16.29-beta-
|
|
29
|
-
"@abtnode/queue": "1.16.29-beta-
|
|
30
|
-
"@abtnode/rbac": "1.16.29-beta-
|
|
31
|
-
"@abtnode/router-provider": "1.16.29-beta-
|
|
32
|
-
"@abtnode/static-server": "1.16.29-beta-
|
|
33
|
-
"@abtnode/timemachine": "1.16.29-beta-
|
|
34
|
-
"@abtnode/util": "1.16.29-beta-
|
|
22
|
+
"@abtnode/analytics": "1.16.29-beta-1fb308f8",
|
|
23
|
+
"@abtnode/auth": "1.16.29-beta-1fb308f8",
|
|
24
|
+
"@abtnode/certificate-manager": "1.16.29-beta-1fb308f8",
|
|
25
|
+
"@abtnode/constant": "1.16.29-beta-1fb308f8",
|
|
26
|
+
"@abtnode/cron": "1.16.29-beta-1fb308f8",
|
|
27
|
+
"@abtnode/logger": "1.16.29-beta-1fb308f8",
|
|
28
|
+
"@abtnode/models": "1.16.29-beta-1fb308f8",
|
|
29
|
+
"@abtnode/queue": "1.16.29-beta-1fb308f8",
|
|
30
|
+
"@abtnode/rbac": "1.16.29-beta-1fb308f8",
|
|
31
|
+
"@abtnode/router-provider": "1.16.29-beta-1fb308f8",
|
|
32
|
+
"@abtnode/static-server": "1.16.29-beta-1fb308f8",
|
|
33
|
+
"@abtnode/timemachine": "1.16.29-beta-1fb308f8",
|
|
34
|
+
"@abtnode/util": "1.16.29-beta-1fb308f8",
|
|
35
35
|
"@arcblock/did": "1.18.126",
|
|
36
36
|
"@arcblock/did-auth": "1.18.126",
|
|
37
37
|
"@arcblock/did-ext": "^1.18.126",
|
|
@@ -42,13 +42,13 @@
|
|
|
42
42
|
"@arcblock/pm2-events": "^0.0.5",
|
|
43
43
|
"@arcblock/validator": "^1.18.126",
|
|
44
44
|
"@arcblock/vc": "1.18.126",
|
|
45
|
-
"@blocklet/constant": "1.16.29-beta-
|
|
46
|
-
"@blocklet/env": "1.16.29-beta-
|
|
47
|
-
"@blocklet/meta": "1.16.29-beta-
|
|
48
|
-
"@blocklet/resolver": "1.16.29-beta-
|
|
49
|
-
"@blocklet/sdk": "1.16.29-beta-
|
|
50
|
-
"@blocklet/store": "1.16.29-beta-
|
|
51
|
-
"@did-space/client": "^0.5.
|
|
45
|
+
"@blocklet/constant": "1.16.29-beta-1fb308f8",
|
|
46
|
+
"@blocklet/env": "1.16.29-beta-1fb308f8",
|
|
47
|
+
"@blocklet/meta": "1.16.29-beta-1fb308f8",
|
|
48
|
+
"@blocklet/resolver": "1.16.29-beta-1fb308f8",
|
|
49
|
+
"@blocklet/sdk": "1.16.29-beta-1fb308f8",
|
|
50
|
+
"@blocklet/store": "1.16.29-beta-1fb308f8",
|
|
51
|
+
"@did-space/client": "^0.5.12",
|
|
52
52
|
"@fidm/x509": "^1.2.1",
|
|
53
53
|
"@ocap/mcrypto": "1.18.126",
|
|
54
54
|
"@ocap/util": "1.18.126",
|
|
@@ -103,5 +103,5 @@
|
|
|
103
103
|
"jest": "^29.7.0",
|
|
104
104
|
"unzipper": "^0.10.11"
|
|
105
105
|
},
|
|
106
|
-
"gitHead": "
|
|
106
|
+
"gitHead": "1bf1d605a02f4df2789215e6e9518a62b1c3f806"
|
|
107
107
|
}
|