@naturalcycles/backend-lib 9.71.0 → 9.72.0
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.
|
@@ -63,7 +63,7 @@ export class BackendServer {
|
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
const cpus = os.cpus().length;
|
|
66
|
-
const availableParallelism = os.availableParallelism
|
|
66
|
+
const availableParallelism = os.availableParallelism();
|
|
67
67
|
const { version, platform, arch } = process;
|
|
68
68
|
console.log(dimGrey(`node ${version} ${platform} ${arch}, NODE_OPTIONS: ${NODE_OPTIONS || 'undefined'}, APP_ENV: ${APP_ENV || 'undefined'}, cpus: ${cpus}, availableParallelism: ${availableParallelism}`));
|
|
69
69
|
console.log(`serverStarted on ${white(address)} in ${dimGrey(_ms(process.uptime() * 1000))}`);
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import os from 'node:os';
|
|
1
2
|
import { localTime } from '@naturalcycles/js-lib/datetime/localTime.js';
|
|
2
3
|
import { _filterNullishValues } from '@naturalcycles/js-lib/object/object.util.js';
|
|
3
4
|
import { memoryUsageFull, processSharedUtil } from '@naturalcycles/nodejs-lib';
|
|
4
5
|
import { getDeployInfo } from '../deploy/deployInfo.util.js';
|
|
5
6
|
const { versions, arch, platform } = process;
|
|
6
|
-
const
|
|
7
|
+
const availableParallelismAtStart = os.availableParallelism();
|
|
8
|
+
const { GAE_APPLICATION, GAE_SERVICE, GAE_VERSION, GOOGLE_CLOUD_PROJECT, K_SERVICE, K_REVISION, APP_ENV, NODE_ENV, NODE_OPTIONS, UV_THREADPOOL_SIZE, MALLOC_ARENA_MAX, DEPLOY_BUILD_TIME, BUILD_VERSION, } = process.env;
|
|
7
9
|
export function serverStatusMiddleware(projectDir, extra) {
|
|
8
10
|
return async (_req, res) => {
|
|
9
11
|
res.json(getServerStatusData(projectDir, extra));
|
|
@@ -15,6 +17,7 @@ export function getServerStatusData(projectDir = process.cwd(), extra) {
|
|
|
15
17
|
const { ts } = getDeployInfo(projectDir);
|
|
16
18
|
deployBuildTime = localTime(ts).toPretty();
|
|
17
19
|
}
|
|
20
|
+
const availableParallelism = os.availableParallelism();
|
|
18
21
|
return _filterNullishValues({
|
|
19
22
|
nodeProcessStarted: getStartedStr(),
|
|
20
23
|
deployBuildTime,
|
|
@@ -33,10 +36,13 @@ export function getServerStatusData(projectDir = process.cwd(), extra) {
|
|
|
33
36
|
mem: memoryUsageFull(),
|
|
34
37
|
cpuAvg: processSharedUtil.cpuAvg(),
|
|
35
38
|
cpuInfo: processSharedUtil.cpuInfo(),
|
|
39
|
+
availableParallelismAtStart,
|
|
40
|
+
availableParallelism,
|
|
36
41
|
versions,
|
|
37
42
|
NODE_OPTIONS,
|
|
38
43
|
NODE_ENV,
|
|
39
44
|
UV_THREADPOOL_SIZE,
|
|
45
|
+
MALLOC_ARENA_MAX,
|
|
40
46
|
...extra,
|
|
41
47
|
});
|
|
42
48
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@naturalcycles/backend-lib",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "9.
|
|
4
|
+
"version": "9.72.0",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@naturalcycles/db-lib": "^10",
|
|
7
7
|
"@naturalcycles/js-lib": "^15",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"peerDependencies": {
|
|
30
30
|
"@sentry/node-core": "^10",
|
|
31
31
|
"firebase-admin": "^14",
|
|
32
|
-
"simple-git": "^
|
|
32
|
+
"simple-git": "^4"
|
|
33
33
|
},
|
|
34
34
|
"peerDependenciesMeta": {
|
|
35
35
|
"@sentry/node-core": {
|
|
@@ -73,7 +73,7 @@ export class BackendServer {
|
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
const cpus = os.cpus().length
|
|
76
|
-
const availableParallelism = os.availableParallelism
|
|
76
|
+
const availableParallelism = os.availableParallelism()
|
|
77
77
|
const { version, platform, arch } = process
|
|
78
78
|
console.log(
|
|
79
79
|
dimGrey(
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import os from 'node:os'
|
|
1
2
|
import { localTime } from '@naturalcycles/js-lib/datetime/localTime.js'
|
|
2
3
|
import { _filterNullishValues } from '@naturalcycles/js-lib/object/object.util.js'
|
|
3
4
|
import { memoryUsageFull, processSharedUtil } from '@naturalcycles/nodejs-lib'
|
|
@@ -5,6 +6,7 @@ import { getDeployInfo } from '../deploy/deployInfo.util.js'
|
|
|
5
6
|
import type { BackendRequestHandler } from './server.model.js'
|
|
6
7
|
|
|
7
8
|
const { versions, arch, platform } = process
|
|
9
|
+
const availableParallelismAtStart = os.availableParallelism()
|
|
8
10
|
const {
|
|
9
11
|
GAE_APPLICATION,
|
|
10
12
|
GAE_SERVICE,
|
|
@@ -16,6 +18,7 @@ const {
|
|
|
16
18
|
NODE_ENV,
|
|
17
19
|
NODE_OPTIONS,
|
|
18
20
|
UV_THREADPOOL_SIZE,
|
|
21
|
+
MALLOC_ARENA_MAX,
|
|
19
22
|
DEPLOY_BUILD_TIME,
|
|
20
23
|
BUILD_VERSION,
|
|
21
24
|
} = process.env
|
|
@@ -36,6 +39,8 @@ export function getServerStatusData(
|
|
|
36
39
|
deployBuildTime = localTime(ts).toPretty()
|
|
37
40
|
}
|
|
38
41
|
|
|
42
|
+
const availableParallelism = os.availableParallelism()
|
|
43
|
+
|
|
39
44
|
return _filterNullishValues({
|
|
40
45
|
nodeProcessStarted: getStartedStr(),
|
|
41
46
|
deployBuildTime,
|
|
@@ -54,10 +59,13 @@ export function getServerStatusData(
|
|
|
54
59
|
mem: memoryUsageFull(),
|
|
55
60
|
cpuAvg: processSharedUtil.cpuAvg(),
|
|
56
61
|
cpuInfo: processSharedUtil.cpuInfo(),
|
|
62
|
+
availableParallelismAtStart,
|
|
63
|
+
availableParallelism,
|
|
57
64
|
versions,
|
|
58
65
|
NODE_OPTIONS,
|
|
59
66
|
NODE_ENV,
|
|
60
67
|
UV_THREADPOOL_SIZE,
|
|
68
|
+
MALLOC_ARENA_MAX,
|
|
61
69
|
...extra,
|
|
62
70
|
})
|
|
63
71
|
}
|