@onlineapps/service-wrapper 2.0.38 → 2.0.39
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/package.json +2 -2
- package/src/ServiceWrapper.js +9 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onlineapps/service-wrapper",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.39",
|
|
4
4
|
"description": "Thin orchestration layer for microservices - delegates all infrastructure concerns to specialized connectors",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"@onlineapps/conn-orch-orchestrator": "^1.0.1",
|
|
34
34
|
"@onlineapps/conn-orch-registry": "^1.1.16",
|
|
35
35
|
"@onlineapps/conn-orch-validator": "^2.0.0",
|
|
36
|
-
"@onlineapps/
|
|
36
|
+
"@onlineapps/service-common": "^1.0.0",
|
|
37
37
|
"@onlineapps/monitoring-core": "^1.0.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
package/src/ServiceWrapper.js
CHANGED
|
@@ -414,7 +414,6 @@ class ServiceWrapper {
|
|
|
414
414
|
const maxRetries = parseInt(process.env.INFRASTRUCTURE_VERIFY_MAX_RETRIES) || 12; // 12 * 5s = 60s max
|
|
415
415
|
const baseDelay = parseInt(process.env.INFRASTRUCTURE_VERIFY_BASE_DELAY) || 5000; // 5 seconds
|
|
416
416
|
const maxDelay = parseInt(process.env.INFRASTRUCTURE_VERIFY_MAX_DELAY) || 30000; // 30 seconds max
|
|
417
|
-
const redisUrl = this.config.wrapper?.cache?.url || process.env.REDIS_URL || 'redis://api_node_cache:6379';
|
|
418
417
|
|
|
419
418
|
// Required infrastructure queues that must exist before business queues can be created
|
|
420
419
|
const requiredInfrastructureQueues = [
|
|
@@ -438,20 +437,24 @@ class ServiceWrapper {
|
|
|
438
437
|
|
|
439
438
|
for (let attempt = 1; attempt <= maxRetries; attempt++) {
|
|
440
439
|
try {
|
|
441
|
-
// Step 1: Check infrastructure health via Redis
|
|
440
|
+
// Step 1: Check infrastructure health via Redis (using service-common)
|
|
441
|
+
// ServiceWrapper uses service-common (shared utility) to maintain architectural separation
|
|
442
442
|
this.logger?.info(`[InfrastructureVerify] Attempt ${attempt}/${maxRetries}: Checking infrastructure health...`);
|
|
443
443
|
|
|
444
|
-
const
|
|
445
|
-
const waitMaxTime = 10000; // 10 seconds per attempt
|
|
446
|
-
const waitCheckInterval = 2000; // Check every 2 seconds
|
|
444
|
+
const redisUrl = this.config.wrapper?.cache?.url || process.env.REDIS_URL || 'redis://api_node_cache:6379';
|
|
447
445
|
|
|
448
446
|
try {
|
|
447
|
+
const { waitForInfrastructureReady } = require('@onlineapps/service-common');
|
|
448
|
+
const waitMaxTime = 10000; // 10 seconds per attempt
|
|
449
|
+
const waitCheckInterval = 2000; // Check every 2 seconds
|
|
450
|
+
|
|
449
451
|
await waitForInfrastructureReady({
|
|
450
452
|
redisUrl: redisUrl,
|
|
451
453
|
maxWait: waitMaxTime,
|
|
452
454
|
checkInterval: waitCheckInterval,
|
|
453
455
|
logger: {
|
|
454
|
-
log: (msg) => this.logger?.info(`[InfrastructureVerify] ${msg}`)
|
|
456
|
+
log: (msg) => this.logger?.info(`[InfrastructureVerify] ${msg}`),
|
|
457
|
+
info: (msg) => this.logger?.info(`[InfrastructureVerify] ${msg}`)
|
|
455
458
|
}
|
|
456
459
|
});
|
|
457
460
|
this.logger?.info('[InfrastructureVerify] ✓ All infrastructure services are UP');
|