@zintrust/workers 0.5.0 → 0.5.1
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/ResourceMonitor.js +2 -2
- package/dist/build-manifest.json +13 -13
- package/package.json +3 -3
- package/src/ResourceMonitor.ts +3 -3
package/dist/ResourceMonitor.js
CHANGED
|
@@ -143,7 +143,7 @@ const calculateCpuUsage = () => {
|
|
|
143
143
|
for (const type in cpu.times) {
|
|
144
144
|
totalTick += cpu.times[type];
|
|
145
145
|
}
|
|
146
|
-
totalIdle += cpu.times
|
|
146
|
+
totalIdle += cpu.times['idle'];
|
|
147
147
|
});
|
|
148
148
|
const now = Date.now();
|
|
149
149
|
// If we have previous measurements, calculate real-time usage
|
|
@@ -413,7 +413,7 @@ const calculateTrend = (workerName, metric, period) => {
|
|
|
413
413
|
});
|
|
414
414
|
// Simple linear regression for trend
|
|
415
415
|
const firstValue = values[0];
|
|
416
|
-
const lastValue = values
|
|
416
|
+
const lastValue = values.at(-1) ?? values[0];
|
|
417
417
|
const changePercentage = ((lastValue - firstValue) / firstValue) * 100;
|
|
418
418
|
let trend;
|
|
419
419
|
if (Math.abs(changePercentage) < 5) {
|
package/dist/build-manifest.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zintrust/workers",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"buildDate": "2026-04-
|
|
3
|
+
"version": "0.5.1",
|
|
4
|
+
"buildDate": "2026-04-12T19:52:07.100Z",
|
|
5
5
|
"buildEnvironment": {
|
|
6
|
-
"node": "
|
|
6
|
+
"node": "v22.22.1",
|
|
7
7
|
"platform": "darwin",
|
|
8
8
|
"arch": "arm64"
|
|
9
9
|
},
|
|
10
10
|
"git": {
|
|
11
|
-
"commit": "
|
|
11
|
+
"commit": "87ea4893",
|
|
12
12
|
"branch": "release"
|
|
13
13
|
},
|
|
14
14
|
"package": {
|
|
@@ -106,8 +106,8 @@
|
|
|
106
106
|
"sha256": "dd82e7e2c23a2fcaefc0cb87a1a7931594d6a5f76b758f608c77063f5e8533cd"
|
|
107
107
|
},
|
|
108
108
|
"DeadLetterQueue.js": {
|
|
109
|
-
"size":
|
|
110
|
-
"sha256": "
|
|
109
|
+
"size": 19512,
|
|
110
|
+
"sha256": "47ad34c16e8e44a7febb849c56d7558f0f5a951a771c7b2e5c73c8db1b718e63"
|
|
111
111
|
},
|
|
112
112
|
"HealthMonitor.d.ts": {
|
|
113
113
|
"size": 1485,
|
|
@@ -162,8 +162,8 @@
|
|
|
162
162
|
"sha256": "97e85eb898813f03871bd3bc0b9dbe67777feb198366b27b01a5281224135e79"
|
|
163
163
|
},
|
|
164
164
|
"ResourceMonitor.js": {
|
|
165
|
-
"size":
|
|
166
|
-
"sha256": "
|
|
165
|
+
"size": 19596,
|
|
166
|
+
"sha256": "c8d016bf18c4daed26f9e42538f0aebf8f4f9d18553116fd32c2ecd343d0f0f3"
|
|
167
167
|
},
|
|
168
168
|
"SLAMonitor.d.ts": {
|
|
169
169
|
"size": 2727,
|
|
@@ -231,7 +231,7 @@
|
|
|
231
231
|
},
|
|
232
232
|
"build-manifest.json": {
|
|
233
233
|
"size": 19881,
|
|
234
|
-
"sha256": "
|
|
234
|
+
"sha256": "e10fb711cf2bcb057cb3956d6d5f765c51da8840ad43b894490a277f52969912"
|
|
235
235
|
},
|
|
236
236
|
"config/workerConfig.d.ts": {
|
|
237
237
|
"size": 282,
|
|
@@ -414,8 +414,8 @@
|
|
|
414
414
|
"sha256": "0dcb7ca21683ab210eeb23d067e41b55ae996fa9e52c688371dc177f070ec059"
|
|
415
415
|
},
|
|
416
416
|
"index.js": {
|
|
417
|
-
"size":
|
|
418
|
-
"sha256": "
|
|
417
|
+
"size": 2336,
|
|
418
|
+
"sha256": "61c5a2ada4b343e59445859ac3cdecb8d7f05bffb89b18f1a2e0f5d99c7f92f9"
|
|
419
419
|
},
|
|
420
420
|
"queueMonitorHistory.d.ts": {
|
|
421
421
|
"size": 433,
|
|
@@ -538,8 +538,8 @@
|
|
|
538
538
|
"sha256": "e1e5ade40867f1a51fb3801beee1f7bd51532267ec78bd47ae866a6a388a51f5"
|
|
539
539
|
},
|
|
540
540
|
"ui/types/worker-ui.d.ts": {
|
|
541
|
-
"size":
|
|
542
|
-
"sha256": "
|
|
541
|
+
"size": 5562,
|
|
542
|
+
"sha256": "c732bd37f434c3e1c05042384f2a6ab286455ccba5eb6d5716f931e3699857e0"
|
|
543
543
|
},
|
|
544
544
|
"ui/types/worker-ui.js": {
|
|
545
545
|
"size": 94,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zintrust/workers",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "Worker orchestration and background job management for ZinTrust.",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"node": ">=20.0.0"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
|
-
"@zintrust/core": ">=0.
|
|
43
|
+
"@zintrust/core": ">=0.5.0 <0.6.0",
|
|
44
44
|
"@zintrust/queue-monitor": "*",
|
|
45
45
|
"@zintrust/queue-redis": "*"
|
|
46
46
|
},
|
|
@@ -73,4 +73,4 @@
|
|
|
73
73
|
"prom-client": "^15.1.3",
|
|
74
74
|
"simple-statistics": "^7.8.9"
|
|
75
75
|
}
|
|
76
|
-
}
|
|
76
|
+
}
|
package/src/ResourceMonitor.ts
CHANGED
|
@@ -224,9 +224,9 @@ const calculateCpuUsage = (): number => {
|
|
|
224
224
|
|
|
225
225
|
cpus.forEach((cpu: { times: Record<string, number> }) => {
|
|
226
226
|
for (const type in cpu.times) {
|
|
227
|
-
totalTick += cpu.times[type
|
|
227
|
+
totalTick += cpu.times[type];
|
|
228
228
|
}
|
|
229
|
-
totalIdle += cpu.times
|
|
229
|
+
totalIdle += cpu.times['idle'];
|
|
230
230
|
});
|
|
231
231
|
|
|
232
232
|
const now = Date.now();
|
|
@@ -534,7 +534,7 @@ const calculateTrend = (
|
|
|
534
534
|
|
|
535
535
|
// Simple linear regression for trend
|
|
536
536
|
const firstValue = values[0];
|
|
537
|
-
const lastValue = values
|
|
537
|
+
const lastValue = values.at(-1) ?? values[0];
|
|
538
538
|
const changePercentage = ((lastValue - firstValue) / firstValue) * 100;
|
|
539
539
|
|
|
540
540
|
let trend: ResourceTrend['trend'];
|