@zintrust/workers 1.8.0 → 2.0.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/HealthMonitor.js +3 -3
- package/dist/WorkerFactory.d.ts +2 -1
- package/dist/WorkerFactory.js +8 -5
- package/dist/WorkerShutdownDurableObject.d.ts +12 -0
- package/dist/WorkerShutdownDurableObject.js +41 -0
- package/dist/build-manifest.json +40 -12
- package/dist/index.d.ts +1 -1
- package/dist/ui/workers/index.html +202 -0
- package/dist/ui/workers/main.js +1952 -0
- package/dist/ui/workers/styles.css +1350 -0
- package/dist/ui/workers/zintrust.svg +30 -0
- package/package.json +2 -2
- package/src/HealthMonitor.ts +3 -3
- package/src/WorkerFactory.ts +14 -13
- package/src/index.ts +1 -1
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<svg width="120" height="120" viewBox="0 0 100 100" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<defs>
|
|
3
|
+
<linearGradient id="zt-g2d" x1="10" y1="50" x2="90" y2="50" gradientUnits="userSpaceOnUse">
|
|
4
|
+
<stop stop-color="#22c55e" />
|
|
5
|
+
<stop offset="1" stop-color="#38bdf8" />
|
|
6
|
+
</linearGradient>
|
|
7
|
+
</defs>
|
|
8
|
+
<circle cx="50" cy="50" r="34" stroke="rgba(255,255,255,0.16)" stroke-width="4" />
|
|
9
|
+
<ellipse cx="50" cy="50" rx="40" ry="18" stroke="url(#zt-g2d)" stroke-width="4" />
|
|
10
|
+
<ellipse cx="50" cy="50" rx="18" ry="40" stroke="url(#zt-g2d)" stroke-width="4" opacity="0.75" />
|
|
11
|
+
<circle cx="50" cy="50" r="6" fill="url(#zt-g2d)" />
|
|
12
|
+
<path
|
|
13
|
+
d="M40 52C35 52 32 49 32 44C32 39 35 36 40 36H48"
|
|
14
|
+
stroke="white"
|
|
15
|
+
stroke-width="6"
|
|
16
|
+
stroke-linecap="round"
|
|
17
|
+
/>
|
|
18
|
+
<path
|
|
19
|
+
d="M60 48C65 48 68 51 68 56C68 61 65 64 60 64H52"
|
|
20
|
+
stroke="white"
|
|
21
|
+
stroke-width="6"
|
|
22
|
+
stroke-linecap="round"
|
|
23
|
+
/>
|
|
24
|
+
<path
|
|
25
|
+
d="M44 50H56"
|
|
26
|
+
stroke="rgba(255,255,255,0.22)"
|
|
27
|
+
stroke-width="6"
|
|
28
|
+
stroke-linecap="round"
|
|
29
|
+
/>
|
|
30
|
+
</svg>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zintrust/workers",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"description": "Worker orchestration and background job management for ZinTrust.",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
@@ -73,4 +73,4 @@
|
|
|
73
73
|
"prom-client": "^15.1.3",
|
|
74
74
|
"simple-statistics": "^7.8.9"
|
|
75
75
|
}
|
|
76
|
-
}
|
|
76
|
+
}
|
package/src/HealthMonitor.ts
CHANGED
|
@@ -86,9 +86,9 @@ const verifyWorkerHealth = async (worker: Worker): Promise<boolean> => {
|
|
|
86
86
|
if (!isRunning) return false;
|
|
87
87
|
|
|
88
88
|
const client = await worker.client;
|
|
89
|
-
const
|
|
90
|
-
if (
|
|
91
|
-
throw ErrorFactory.createWorkerError(
|
|
89
|
+
const redisInfo = await client.info();
|
|
90
|
+
if (redisInfo.trim() === '') {
|
|
91
|
+
throw ErrorFactory.createWorkerError('Redis info command returned empty response');
|
|
92
92
|
}
|
|
93
93
|
return true;
|
|
94
94
|
};
|
package/src/WorkerFactory.ts
CHANGED
|
@@ -6,10 +6,6 @@
|
|
|
6
6
|
|
|
7
7
|
import * as ZintrustCoreModule from '@zintrust/core';
|
|
8
8
|
import {
|
|
9
|
-
Cloudflare,
|
|
10
|
-
createRedisConnection,
|
|
11
|
-
databaseConfig,
|
|
12
|
-
DatabaseConnectionRegistry,
|
|
13
9
|
Env,
|
|
14
10
|
ErrorFactory,
|
|
15
11
|
generateUuid,
|
|
@@ -17,18 +13,23 @@ import {
|
|
|
17
13
|
isFunction,
|
|
18
14
|
isNonEmptyString,
|
|
19
15
|
isObject,
|
|
20
|
-
JobStateTracker,
|
|
21
16
|
Logger,
|
|
22
17
|
NodeSingletons,
|
|
23
|
-
queueConfig,
|
|
24
|
-
registerDatabasesFromRuntimeConfig,
|
|
25
18
|
useEnsureDbConnected,
|
|
26
|
-
workersConfig,
|
|
27
19
|
ZintrustLang,
|
|
28
20
|
type IDatabase,
|
|
29
|
-
type RedisConfig,
|
|
30
21
|
type WorkerStatus,
|
|
31
22
|
} from '@zintrust/core';
|
|
23
|
+
import {
|
|
24
|
+
Cloudflare,
|
|
25
|
+
createRedisConnection,
|
|
26
|
+
databaseConfig,
|
|
27
|
+
queueConfig,
|
|
28
|
+
workersConfig,
|
|
29
|
+
type RedisConfig,
|
|
30
|
+
} from '@zintrust/core/config';
|
|
31
|
+
import { DatabaseConnectionRegistry, registerDatabasesFromRuntimeConfig } from '@zintrust/core/orm';
|
|
32
|
+
import { JobStateTracker } from '@zintrust/core/tools/queue';
|
|
32
33
|
import { Worker, type Job, type WorkerOptions } from 'bullmq';
|
|
33
34
|
import { AutoScaler, type AutoScalerConfig } from './AutoScaler';
|
|
34
35
|
import { CanaryController } from './CanaryController';
|
|
@@ -1234,9 +1235,9 @@ const waitForWorkerConnection = async (
|
|
|
1234
1235
|
|
|
1235
1236
|
// Check Redis connection
|
|
1236
1237
|
const client = await worker.client;
|
|
1237
|
-
const
|
|
1238
|
-
if (
|
|
1239
|
-
throw ErrorFactory.createWorkerError('Redis
|
|
1238
|
+
const redisInfo = await client.info();
|
|
1239
|
+
if (redisInfo.trim() === '') {
|
|
1240
|
+
throw ErrorFactory.createWorkerError('Redis info command returned empty response');
|
|
1240
1241
|
}
|
|
1241
1242
|
|
|
1242
1243
|
// Removed heavy Queue instantiation loop - relying on Redis ping for connectivity check
|
|
@@ -1244,7 +1245,7 @@ const waitForWorkerConnection = async (
|
|
|
1244
1245
|
|
|
1245
1246
|
Logger.debug(`Worker health verification passed for ${name}`, {
|
|
1246
1247
|
isRunning,
|
|
1247
|
-
|
|
1248
|
+
redisInfoLength: redisInfo.length,
|
|
1248
1249
|
});
|
|
1249
1250
|
|
|
1250
1251
|
if (timeoutId) clearTimeout(timeoutId);
|
package/src/index.ts
CHANGED
|
@@ -75,7 +75,7 @@ export type {
|
|
|
75
75
|
WorkersGlobalConfig,
|
|
76
76
|
WorkerStatus,
|
|
77
77
|
WorkerVersioningConfig,
|
|
78
|
-
} from '@zintrust/core';
|
|
78
|
+
} from '@zintrust/core/config';
|
|
79
79
|
|
|
80
80
|
// Re-export bullmq types for type compatibility
|
|
81
81
|
export type { Job, Worker, WorkerOptions } from 'bullmq';
|