@zintrust/core 1.5.3 → 1.5.5
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/bin/z.js +102 -2
- package/bin/zin.js +192 -2
- package/bin/zintrust-main.d.ts.map +1 -1
- package/bin/zintrust-main.js +32 -6
- package/bin/zintrust.d.ts.map +1 -1
- package/bin/zintrust.js +102 -2
- package/bin/zt.js +99 -2
- package/package.json +1 -1
- package/src/boot/bootstrap.d.ts +1 -1
- package/src/boot/bootstrap.d.ts.map +1 -1
- package/src/boot/bootstrap.js +119 -49
- package/src/boot/registry/runtime.d.ts.map +1 -1
- package/src/boot/registry/runtime.js +37 -2
- package/src/boot/registry/worker.d.ts.map +1 -1
- package/src/boot/registry/worker.js +3 -2
- package/src/cli/commands/StartCommand.d.ts.map +1 -1
- package/src/cli/commands/StartCommand.js +1 -0
- package/src/cli/utils/spawn.d.ts +1 -0
- package/src/cli/utils/spawn.d.ts.map +1 -1
- package/src/cli/utils/spawn.js +311 -38
- package/src/config/index.d.ts +2 -1
- package/src/config/index.d.ts.map +1 -1
- package/src/config/index.js +3 -3
- package/src/config/queue.d.ts.map +1 -1
- package/src/config/queue.js +32 -3
- package/src/helper/ShutdownTrace.d.ts +9 -0
- package/src/helper/ShutdownTrace.d.ts.map +1 -0
- package/src/helper/ShutdownTrace.js +165 -0
- package/src/helper/index.d.ts +1 -0
- package/src/helper/index.d.ts.map +1 -1
- package/src/helper/index.js +1 -0
- package/src/http/RequestContext.d.ts.map +1 -1
- package/src/http/RequestContext.js +6 -3
- package/src/index.js +3 -3
- package/src/migrations/schema/Schema.d.ts.map +1 -1
- package/src/migrations/schema/Schema.js +4 -3
- package/src/runtime/PluginManager.d.ts.map +1 -1
- package/src/runtime/PluginManager.js +9 -3
- package/src/runtime/WorkerAdapterImports.d.ts +2 -2
- package/src/runtime/WorkerAdapterImports.js +1 -1
- package/src/runtime/plugins/trace-runtime.d.ts.map +1 -1
- package/src/runtime/plugins/trace-runtime.js +2 -1
- package/src/runtime/plugins/trace.d.ts +1 -0
- package/src/runtime/plugins/trace.d.ts.map +1 -1
- package/src/runtime/plugins/trace.js +7 -5
- package/src/tools/queue/QueueReliabilityOrchestrator.d.ts.map +1 -1
- package/src/tools/queue/QueueReliabilityOrchestrator.js +11 -0
package/src/boot/bootstrap.js
CHANGED
|
@@ -11,6 +11,7 @@ import { Env } from '../config/env.js';
|
|
|
11
11
|
import { Logger } from '../config/logger.js';
|
|
12
12
|
import { shutdownRedisConnections } from '../config/workers.js';
|
|
13
13
|
import { ErrorFactory } from '../exceptions/ZintrustError.js';
|
|
14
|
+
import { ShutdownTrace } from '../helper/ShutdownTrace.js';
|
|
14
15
|
import { ProjectRuntime } from '../runtime/ProjectRuntime.js';
|
|
15
16
|
import { StartupErrorLogging } from '../runtime/StartupErrorLogging.js';
|
|
16
17
|
import { WorkerProjectAutoImports } from '../runtime/WorkerProjectAutoImports.js';
|
|
@@ -92,66 +93,130 @@ const withTimeout = async (promise, timeoutMs, label) => {
|
|
|
92
93
|
globalThis.clearTimeout(timeoutId);
|
|
93
94
|
}
|
|
94
95
|
};
|
|
96
|
+
const shutdownWorkersIfNeeded = async (signal, remainingMs) => {
|
|
97
|
+
if (appConfig.worker !== true ||
|
|
98
|
+
(appConfig.detectRuntime() !== 'nodejs' && appConfig.detectRuntime() !== 'lambda') ||
|
|
99
|
+
appConfig.dockerWorker === true) {
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
try {
|
|
103
|
+
ShutdownTrace.log('bootstrap.graceful-shutdown.worker-shutdown.start', {
|
|
104
|
+
signal,
|
|
105
|
+
remainingMs: remainingMs(),
|
|
106
|
+
});
|
|
107
|
+
const workers = await loadWorkersModule();
|
|
108
|
+
const workerBudgetMs = Math.min(15000, remainingMs());
|
|
109
|
+
await withTimeout(workers.WorkerShutdown.shutdown({
|
|
110
|
+
signal,
|
|
111
|
+
timeout: workerBudgetMs,
|
|
112
|
+
forceExit: false,
|
|
113
|
+
}), workerBudgetMs, 'Worker shutdown timed out');
|
|
114
|
+
ShutdownTrace.logHandles('bootstrap.graceful-shutdown.worker-shutdown.complete', {
|
|
115
|
+
workerBudgetMs,
|
|
116
|
+
remainingMs: remainingMs(),
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
catch (error) {
|
|
120
|
+
Logger.warn('Worker shutdown failed (continuing with app shutdown)', error);
|
|
121
|
+
ShutdownTrace.logHandles('bootstrap.graceful-shutdown.worker-shutdown.failed', {
|
|
122
|
+
remainingMs: remainingMs(),
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
const shutdownServerIfNeeded = async (remainingMs) => {
|
|
127
|
+
if (serverInstance === undefined)
|
|
128
|
+
return;
|
|
129
|
+
ShutdownTrace.log('bootstrap.graceful-shutdown.server-close.start', {
|
|
130
|
+
remainingMs: remainingMs(),
|
|
131
|
+
});
|
|
132
|
+
await serverInstance.close();
|
|
133
|
+
ShutdownTrace.logHandles('bootstrap.graceful-shutdown.server-close.complete', {
|
|
134
|
+
remainingMs: remainingMs(),
|
|
135
|
+
});
|
|
136
|
+
};
|
|
137
|
+
const shutdownAppIfNeeded = async (remainingMs) => {
|
|
138
|
+
if (appInstance === undefined)
|
|
139
|
+
return;
|
|
140
|
+
try {
|
|
141
|
+
const appBudgetMs = Math.min(5000, remainingMs());
|
|
142
|
+
ShutdownTrace.log('bootstrap.graceful-shutdown.app-shutdown.start', {
|
|
143
|
+
appBudgetMs,
|
|
144
|
+
remainingMs: remainingMs(),
|
|
145
|
+
});
|
|
146
|
+
await withTimeout(appInstance.shutdown(), appBudgetMs, 'App shutdown timed out');
|
|
147
|
+
ShutdownTrace.logHandles('bootstrap.graceful-shutdown.app-shutdown.complete', {
|
|
148
|
+
appBudgetMs,
|
|
149
|
+
remainingMs: remainingMs(),
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
catch (error) {
|
|
153
|
+
Logger.warn('App shutdown failed or timed out, forcing exit', error);
|
|
154
|
+
ShutdownTrace.logHandles('bootstrap.graceful-shutdown.app-shutdown.failed', {
|
|
155
|
+
remainingMs: remainingMs(),
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
const shutdownTrackedRedis = async (remainingMs) => {
|
|
160
|
+
try {
|
|
161
|
+
const redisBudgetMs = Math.max(250, Math.min(3000, remainingMs()));
|
|
162
|
+
ShutdownTrace.log('bootstrap.graceful-shutdown.redis-shutdown.start', {
|
|
163
|
+
redisBudgetMs,
|
|
164
|
+
remainingMs: remainingMs(),
|
|
165
|
+
});
|
|
166
|
+
await withTimeout(shutdownRedisConnections(), redisBudgetMs, 'Redis connection shutdown timed out');
|
|
167
|
+
ShutdownTrace.logHandles('bootstrap.graceful-shutdown.redis-shutdown.complete', {
|
|
168
|
+
redisBudgetMs,
|
|
169
|
+
remainingMs: remainingMs(),
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
catch (error) {
|
|
173
|
+
Logger.warn('Redis connection shutdown failed (continuing with app shutdown)', error);
|
|
174
|
+
ShutdownTrace.logHandles('bootstrap.graceful-shutdown.redis-shutdown.failed', {
|
|
175
|
+
remainingMs: remainingMs(),
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
const runGracefulShutdownPhases = async (signal, remainingMs) => {
|
|
180
|
+
await shutdownWorkersIfNeeded(signal, remainingMs);
|
|
181
|
+
await shutdownServerIfNeeded(remainingMs);
|
|
182
|
+
await shutdownAppIfNeeded(remainingMs);
|
|
183
|
+
await shutdownTrackedRedis(remainingMs);
|
|
184
|
+
Logger.info('✅ Application shut down successfully');
|
|
185
|
+
ShutdownTrace.logHandles('bootstrap.graceful-shutdown.complete', {
|
|
186
|
+
remainingMs: remainingMs(),
|
|
187
|
+
});
|
|
188
|
+
};
|
|
95
189
|
const gracefulShutdown = async (signal) => {
|
|
96
190
|
if (isShuttingDown)
|
|
97
191
|
return;
|
|
98
192
|
isShuttingDown = true;
|
|
99
|
-
const shutdownBudgetMs = Env.getInt('SHUTDOWN_TIMEOUT',
|
|
193
|
+
const shutdownBudgetMs = Env.getInt('SHUTDOWN_TIMEOUT', 10000);
|
|
100
194
|
const minForceExitMs = shutdownBudgetMs + 250;
|
|
101
195
|
const forceExitMs = Math.max(Env.getInt('SHUTDOWN_FORCE_EXIT_MS', 10000), minForceExitMs);
|
|
102
196
|
const deadlineMs = Date.now() + shutdownBudgetMs;
|
|
103
197
|
const remainingMs = () => Math.max(0, deadlineMs - Date.now());
|
|
104
198
|
Logger.info(`${signal} received, shutting down gracefully...`);
|
|
199
|
+
ShutdownTrace.logHandles('bootstrap.graceful-shutdown.received', {
|
|
200
|
+
signal,
|
|
201
|
+
shutdownBudgetMs,
|
|
202
|
+
forceExitMs,
|
|
203
|
+
workerEnabled: appConfig.worker,
|
|
204
|
+
});
|
|
105
205
|
try {
|
|
106
206
|
const forceExitTimer = globalThis.setTimeout(() => {
|
|
107
207
|
process.exit(0);
|
|
108
208
|
}, forceExitMs);
|
|
109
209
|
// Best-effort: don't keep the process alive just for this timer
|
|
110
210
|
forceExitTimer.unref?.();
|
|
111
|
-
await withTimeout((
|
|
112
|
-
// Shutdown worker management system FIRST (before database closes)
|
|
113
|
-
if (appConfig.worker === true &&
|
|
114
|
-
(appConfig.detectRuntime() === 'nodejs' || appConfig.detectRuntime() === 'lambda') &&
|
|
115
|
-
appConfig.dockerWorker === false) {
|
|
116
|
-
try {
|
|
117
|
-
const workers = await loadWorkersModule();
|
|
118
|
-
const workerBudgetMs = Math.min(15000, remainingMs());
|
|
119
|
-
await withTimeout(workers.WorkerShutdown.shutdown({
|
|
120
|
-
signal,
|
|
121
|
-
timeout: workerBudgetMs,
|
|
122
|
-
forceExit: false,
|
|
123
|
-
}), workerBudgetMs, 'Worker shutdown timed out');
|
|
124
|
-
}
|
|
125
|
-
catch (error) {
|
|
126
|
-
Logger.warn('Worker shutdown failed (continuing with app shutdown)', error);
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
if (serverInstance !== undefined) {
|
|
130
|
-
await serverInstance.close();
|
|
131
|
-
}
|
|
132
|
-
if (appInstance !== undefined) {
|
|
133
|
-
try {
|
|
134
|
-
const appBudgetMs = Math.min(5000, remainingMs());
|
|
135
|
-
await withTimeout(appInstance.shutdown(), appBudgetMs, 'App shutdown timed out');
|
|
136
|
-
}
|
|
137
|
-
catch (error) {
|
|
138
|
-
Logger.warn('App shutdown failed or timed out, forcing exit', error);
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
try {
|
|
142
|
-
const redisBudgetMs = Math.max(250, Math.min(3000, remainingMs()));
|
|
143
|
-
await withTimeout(shutdownRedisConnections(), redisBudgetMs, 'Redis connection shutdown timed out');
|
|
144
|
-
}
|
|
145
|
-
catch (error) {
|
|
146
|
-
Logger.warn('Redis connection shutdown failed (continuing with app shutdown)', error);
|
|
147
|
-
}
|
|
148
|
-
Logger.info('✅ Application shut down successfully');
|
|
149
|
-
})(), shutdownBudgetMs, 'Graceful shutdown timed out');
|
|
211
|
+
await withTimeout(runGracefulShutdownPhases(signal, remainingMs), shutdownBudgetMs, 'Graceful shutdown timed out');
|
|
150
212
|
globalThis.clearTimeout(forceExitTimer);
|
|
151
213
|
process.exit(0);
|
|
152
214
|
}
|
|
153
215
|
catch (error) {
|
|
154
216
|
Logger.error('Graceful shutdown failed:', error);
|
|
217
|
+
ShutdownTrace.logHandles('bootstrap.graceful-shutdown.error', {
|
|
218
|
+
error: error instanceof Error ? error.message : String(error),
|
|
219
|
+
});
|
|
155
220
|
process.exit(1);
|
|
156
221
|
}
|
|
157
222
|
};
|
|
@@ -283,15 +348,20 @@ const BootstrapFunctions = Object.freeze({
|
|
|
283
348
|
});
|
|
284
349
|
},
|
|
285
350
|
});
|
|
286
|
-
|
|
287
|
-
await BootstrapFunctions.start().catch((error) => {
|
|
351
|
+
const startBootstrap = async () => {
|
|
288
352
|
try {
|
|
289
|
-
|
|
353
|
+
await BootstrapFunctions.start();
|
|
354
|
+
BootstrapFunctions.setupShutdownHandler();
|
|
290
355
|
}
|
|
291
|
-
catch {
|
|
292
|
-
|
|
356
|
+
catch (error) {
|
|
357
|
+
try {
|
|
358
|
+
Logger.error('Failed to bootstrap application:', error);
|
|
359
|
+
}
|
|
360
|
+
catch {
|
|
361
|
+
// best-effort logging
|
|
362
|
+
}
|
|
363
|
+
process.exit(1);
|
|
293
364
|
}
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
BootstrapFunctions.setupShutdownHandler();
|
|
365
|
+
};
|
|
366
|
+
// Run bootstrap without parse-time top-level await so Worker bundles can load this module.
|
|
367
|
+
export const bootstrapReady = startBootstrap();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../../src/boot/registry/runtime.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../../src/boot/registry/runtime.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAUvD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAkQ9C,eAAO,MAAM,8BAA8B,GAAI,iBAAiB,gBAAgB,KAAG,IA6BlF,CAAC;AA8UF,eAAO,MAAM,eAAe,GAAI,QAAQ;IACtC,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,EAAE,MAAM,CAAC;IACzB,MAAM,EAAE,OAAO,CAAC;IAChB,eAAe,EAAE,gBAAgB,CAAC;IAClC,SAAS,EAAE,MAAM,OAAO,CAAC;IACzB,SAAS,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CACrC,KAAG;IAAE,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAAC,QAAQ,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;CAsH7D,CAAC"}
|
|
@@ -11,7 +11,7 @@ import { Logger } from '../../config/logger.js';
|
|
|
11
11
|
import notificationConfig from '../../config/notification.js';
|
|
12
12
|
import { StartupConfigValidator } from '../../config/StartupConfigValidator.js';
|
|
13
13
|
import { ErrorFactory } from '../../exceptions/ZintrustError.js';
|
|
14
|
-
import { isNonEmptyString } from '../../helper/index.js';
|
|
14
|
+
import { isNonEmptyString, ShutdownTrace } from '../../helper/index.js';
|
|
15
15
|
import { existsSync } from '../../node-singletons/fs.js';
|
|
16
16
|
import * as path from '../../node-singletons/path.js';
|
|
17
17
|
import { pathToFileURL } from '../../node-singletons/url.js';
|
|
@@ -23,6 +23,7 @@ import { SocketFeature } from '../../sockets/SocketRuntime.js';
|
|
|
23
23
|
import { SocketRuntimeRegistry } from '../../sockets/SocketRuntimeRegistry.js';
|
|
24
24
|
import { registerBroadcastersFromRuntimeConfig } from '../../tools/broadcast/BroadcastRuntimeRegistration.js';
|
|
25
25
|
import { registerNotificationChannelsFromRuntimeConfig } from '../../tools/notification/NotificationRuntimeRegistration.js';
|
|
26
|
+
import { QueueReliabilityOrchestrator } from '../../tools/queue/QueueReliabilityOrchestrator.js';
|
|
26
27
|
import { registerQueuesFromRuntimeConfig } from '../../tools/queue/QueueRuntimeRegistration.js';
|
|
27
28
|
import { registerDisksFromRuntimeConfig } from '../../tools/storage/StorageRuntimeRegistration.js';
|
|
28
29
|
const importFromExistingCandidates = async (moduleCandidates) => {
|
|
@@ -332,6 +333,10 @@ const initializeQueueMonitor = async (router) => {
|
|
|
332
333
|
knownQueues: resolveKnownQueues,
|
|
333
334
|
redis: redisConfig,
|
|
334
335
|
});
|
|
336
|
+
runtimeQueueMonitor = monitor;
|
|
337
|
+
ShutdownTrace.logHandles('runtime.queue-monitor.created', {
|
|
338
|
+
basePath: monitorConfig.basePath ?? '',
|
|
339
|
+
});
|
|
335
340
|
try {
|
|
336
341
|
monitor.registerRoutes(router);
|
|
337
342
|
}
|
|
@@ -341,6 +346,7 @@ const initializeQueueMonitor = async (router) => {
|
|
|
341
346
|
Logger.info(`Queue Monitor routes registered at http://127.0.0.1:${appConfig.port}${monitorConfig.basePath ?? ''}`);
|
|
342
347
|
Logger.info(`Queue Monitor enqueue endpoint at http://127.0.0.1:${appConfig.port}/test/enqueue`);
|
|
343
348
|
};
|
|
349
|
+
let runtimeQueueMonitor = null;
|
|
344
350
|
const initializeWorkers = async (router) => {
|
|
345
351
|
const workers = await loadWorkersModule({ allowWhenDisabled: true });
|
|
346
352
|
if (workers?.WorkerInit !== undefined && typeof workers.registerWorkerRoutes === 'function') {
|
|
@@ -528,7 +534,12 @@ export const createLifecycle = (params) => {
|
|
|
528
534
|
initializeSockets(params.router);
|
|
529
535
|
await initializeSystemTrace(params.router);
|
|
530
536
|
if (Cloudflare.getWorkersEnv() === null && appConfig.dockerWorker === false) {
|
|
531
|
-
|
|
537
|
+
if (appConfig.worker === true) {
|
|
538
|
+
await initializeWorkers(params.router);
|
|
539
|
+
}
|
|
540
|
+
else {
|
|
541
|
+
Logger.info('Skipping worker route registration (WORKER_ENABLED=false).');
|
|
542
|
+
}
|
|
532
543
|
await initializeQueueMonitor(params.router);
|
|
533
544
|
if (appConfig.worker === true) {
|
|
534
545
|
await initializeQueueHttpGateway(params.router);
|
|
@@ -548,11 +559,34 @@ export const createLifecycle = (params) => {
|
|
|
548
559
|
};
|
|
549
560
|
const shutdown = async () => {
|
|
550
561
|
Logger.info('🛑 Shutting down application...');
|
|
562
|
+
ShutdownTrace.logHandles('runtime.lifecycle.shutdown.start');
|
|
563
|
+
QueueReliabilityOrchestrator.stop();
|
|
564
|
+
ShutdownTrace.logHandles('runtime.lifecycle.shutdown.after-queue-reliability-stop');
|
|
565
|
+
if (runtimeQueueMonitor !== null && typeof runtimeQueueMonitor.close === 'function') {
|
|
566
|
+
try {
|
|
567
|
+
ShutdownTrace.log('runtime.lifecycle.shutdown.queue-monitor-close.start');
|
|
568
|
+
await runtimeQueueMonitor.close();
|
|
569
|
+
ShutdownTrace.logHandles('runtime.lifecycle.shutdown.queue-monitor-close.complete');
|
|
570
|
+
}
|
|
571
|
+
catch (error) {
|
|
572
|
+
Logger.warn('Queue Monitor shutdown failed', error);
|
|
573
|
+
ShutdownTrace.logHandles('runtime.lifecycle.shutdown.queue-monitor-close.failed', {
|
|
574
|
+
error: error instanceof Error ? error.message : String(error),
|
|
575
|
+
});
|
|
576
|
+
}
|
|
577
|
+
finally {
|
|
578
|
+
runtimeQueueMonitor = null;
|
|
579
|
+
}
|
|
580
|
+
}
|
|
551
581
|
try {
|
|
552
582
|
await params.shutdownManager.run();
|
|
583
|
+
ShutdownTrace.logHandles('runtime.lifecycle.shutdown.after-hooks');
|
|
553
584
|
}
|
|
554
585
|
catch (error) {
|
|
555
586
|
Logger.error('Shutdown hook failed:', error);
|
|
587
|
+
ShutdownTrace.logHandles('runtime.lifecycle.shutdown.hooks-failed', {
|
|
588
|
+
error: error instanceof Error ? error.message : String(error),
|
|
589
|
+
});
|
|
556
590
|
}
|
|
557
591
|
// Ensure FileLogWriter.flush is attempted even if dynamic registration failed.
|
|
558
592
|
try {
|
|
@@ -563,6 +597,7 @@ export const createLifecycle = (params) => {
|
|
|
563
597
|
/* best-effort */
|
|
564
598
|
}
|
|
565
599
|
params.setBooted(false);
|
|
600
|
+
ShutdownTrace.logHandles('runtime.lifecycle.shutdown.complete');
|
|
566
601
|
};
|
|
567
602
|
return { boot, shutdown };
|
|
568
603
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worker.d.ts","sourceRoot":"","sources":["../../../../src/boot/registry/worker.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAGvD;;GAEG;AACH,eAAO,MAAM,0BAA0B,GACrC,iBAAiB,gBAAgB,KAChC,OAAO,CAAC,IAAI,
|
|
1
|
+
{"version":3,"file":"worker.d.ts","sourceRoot":"","sources":["../../../../src/boot/registry/worker.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAGvD;;GAEG;AACH,eAAO,MAAM,0BAA0B,GACrC,iBAAiB,gBAAgB,KAChC,OAAO,CAAC,IAAI,CA2Cd,CAAC"}
|
|
@@ -5,7 +5,8 @@ import { loadWorkersModule } from '../../runtime/WorkersModule.js';
|
|
|
5
5
|
* Helper: Register Worker management system shutdown hook
|
|
6
6
|
*/
|
|
7
7
|
export const registerWorkerShutdownHook = async (shutdownManager) => {
|
|
8
|
-
if (
|
|
8
|
+
if (appConfig.worker !== true ||
|
|
9
|
+
Env.getBool('WORKER_SHUTDOWN_ON_APP_EXIT', true) === false ||
|
|
9
10
|
appConfig.dockerWorker === true) {
|
|
10
11
|
return Promise.resolve(); // NOSONAR - Skip worker shutdown hook registration
|
|
11
12
|
}
|
|
@@ -17,7 +18,7 @@ export const registerWorkerShutdownHook = async (shutdownManager) => {
|
|
|
17
18
|
const mod = (await loadWorkersModule());
|
|
18
19
|
const isShuttingDown = typeof mod.WorkerShutdown.isShuttingDown === 'function'
|
|
19
20
|
? mod.WorkerShutdown.isShuttingDown()
|
|
20
|
-
: mod.WorkerShutdown.getShutdownState?.().isShuttingDown ?? false;
|
|
21
|
+
: (mod.WorkerShutdown.getShutdownState?.().isShuttingDown ?? false);
|
|
21
22
|
const completedAt = mod.WorkerShutdown.getShutdownState?.().completedAt ?? null;
|
|
22
23
|
if (isShuttingDown || completedAt !== null)
|
|
23
24
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StartCommand.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/StartCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoC,KAAK,YAAY,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"StartCommand.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/StartCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoC,KAAK,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAugCvF,eAAO,MAAM,YAAY;cACb,YAAY;;mCA38BU,MAAM,KAAG,OAAO;4CAaP,MAAM,KAAG,MAAM;4CA4Bf,MAAM,KAAG,OAAO;sCAetB,MAAM,WAAW,MAAM,KAAG,OAAO;oCAmBnC,MAAM,KAAG,OAAO;;EA26BjD,CAAC"}
|
|
@@ -635,6 +635,7 @@ const executeNodeStart = async (cmd, context, mode, watchEnabled, _port) => {
|
|
|
635
635
|
command: dev.command,
|
|
636
636
|
args: dev.args,
|
|
637
637
|
forwardSignals: false,
|
|
638
|
+
ttySignalForwardDelayMs: 1500,
|
|
638
639
|
env: {
|
|
639
640
|
...buildStartEnv(context.projectRoot),
|
|
640
641
|
ZINTRUST_BOOTSTRAP_PREFERENCE: 'source',
|
package/src/cli/utils/spawn.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spawn.d.ts","sourceRoot":"","sources":["../../../../src/cli/utils/spawn.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACxB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;
|
|
1
|
+
{"version":3,"file":"spawn.d.ts","sourceRoot":"","sources":["../../../../src/cli/utils/spawn.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACxB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAyYD,eAAO,MAAM,SAAS;wBACM,iBAAiB,GAAG,OAAO,CAAC,MAAM,CAAC;EA8E7D,CAAC"}
|