atomic-queues 1.0.13
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/README.md +686 -0
- package/dist/decorators/decorators.d.ts +67 -0
- package/dist/decorators/decorators.d.ts.map +1 -0
- package/dist/decorators/decorators.js +91 -0
- package/dist/decorators/decorators.js.map +1 -0
- package/dist/decorators/index.d.ts +2 -0
- package/dist/decorators/index.d.ts.map +1 -0
- package/dist/decorators/index.js +18 -0
- package/dist/decorators/index.js.map +1 -0
- package/dist/domain/index.d.ts +5 -0
- package/dist/domain/index.d.ts.map +1 -0
- package/dist/domain/index.js +21 -0
- package/dist/domain/index.js.map +1 -0
- package/dist/domain/interfaces.d.ts +614 -0
- package/dist/domain/interfaces.d.ts.map +1 -0
- package/dist/domain/interfaces.js +19 -0
- package/dist/domain/interfaces.js.map +1 -0
- package/dist/index.d.ts +40 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +61 -0
- package/dist/index.js.map +1 -0
- package/dist/module/atomic-queues.module.d.ts +97 -0
- package/dist/module/atomic-queues.module.d.ts.map +1 -0
- package/dist/module/atomic-queues.module.js +197 -0
- package/dist/module/atomic-queues.module.js.map +1 -0
- package/dist/module/index.d.ts +2 -0
- package/dist/module/index.d.ts.map +1 -0
- package/dist/module/index.js +18 -0
- package/dist/module/index.js.map +1 -0
- package/dist/services/constants.d.ts +10 -0
- package/dist/services/constants.d.ts.map +1 -0
- package/dist/services/constants.js +13 -0
- package/dist/services/constants.js.map +1 -0
- package/dist/services/cron-manager/cron-manager.service.d.ts +188 -0
- package/dist/services/cron-manager/cron-manager.service.d.ts.map +1 -0
- package/dist/services/cron-manager/cron-manager.service.js +534 -0
- package/dist/services/cron-manager/cron-manager.service.js.map +1 -0
- package/dist/services/cron-manager/index.d.ts +2 -0
- package/dist/services/cron-manager/index.d.ts.map +1 -0
- package/dist/services/cron-manager/index.js +18 -0
- package/dist/services/cron-manager/index.js.map +1 -0
- package/dist/services/index-manager/index-manager.service.d.ts +146 -0
- package/dist/services/index-manager/index-manager.service.d.ts.map +1 -0
- package/dist/services/index-manager/index-manager.service.js +337 -0
- package/dist/services/index-manager/index-manager.service.js.map +1 -0
- package/dist/services/index-manager/index.d.ts +2 -0
- package/dist/services/index-manager/index.d.ts.map +1 -0
- package/dist/services/index-manager/index.js +18 -0
- package/dist/services/index-manager/index.js.map +1 -0
- package/dist/services/index.d.ts +10 -0
- package/dist/services/index.d.ts.map +1 -0
- package/dist/services/index.js +26 -0
- package/dist/services/index.js.map +1 -0
- package/dist/services/job-processor/index.d.ts +2 -0
- package/dist/services/job-processor/index.d.ts.map +1 -0
- package/dist/services/job-processor/index.js +18 -0
- package/dist/services/job-processor/index.js.map +1 -0
- package/dist/services/job-processor/job-processor.service.d.ts +156 -0
- package/dist/services/job-processor/job-processor.service.d.ts.map +1 -0
- package/dist/services/job-processor/job-processor.service.js +331 -0
- package/dist/services/job-processor/job-processor.service.js.map +1 -0
- package/dist/services/queue-manager/index.d.ts +2 -0
- package/dist/services/queue-manager/index.d.ts.map +1 -0
- package/dist/services/queue-manager/index.js +18 -0
- package/dist/services/queue-manager/index.js.map +1 -0
- package/dist/services/queue-manager/queue-manager.service.d.ts +128 -0
- package/dist/services/queue-manager/queue-manager.service.d.ts.map +1 -0
- package/dist/services/queue-manager/queue-manager.service.js +308 -0
- package/dist/services/queue-manager/queue-manager.service.js.map +1 -0
- package/dist/services/resource-lock/index.d.ts +2 -0
- package/dist/services/resource-lock/index.d.ts.map +1 -0
- package/dist/services/resource-lock/index.js +18 -0
- package/dist/services/resource-lock/index.js.map +1 -0
- package/dist/services/resource-lock/resource-lock.service.d.ts +124 -0
- package/dist/services/resource-lock/resource-lock.service.d.ts.map +1 -0
- package/dist/services/resource-lock/resource-lock.service.js +379 -0
- package/dist/services/resource-lock/resource-lock.service.js.map +1 -0
- package/dist/services/service-queue/index.d.ts +2 -0
- package/dist/services/service-queue/index.d.ts.map +1 -0
- package/dist/services/service-queue/index.js +18 -0
- package/dist/services/service-queue/index.js.map +1 -0
- package/dist/services/service-queue/service-queue.service.d.ts +232 -0
- package/dist/services/service-queue/service-queue.service.d.ts.map +1 -0
- package/dist/services/service-queue/service-queue.service.js +647 -0
- package/dist/services/service-queue/service-queue.service.js.map +1 -0
- package/dist/services/shutdown-state/index.d.ts +2 -0
- package/dist/services/shutdown-state/index.d.ts.map +1 -0
- package/dist/services/shutdown-state/index.js +18 -0
- package/dist/services/shutdown-state/index.js.map +1 -0
- package/dist/services/shutdown-state/shutdown-state.service.d.ts +69 -0
- package/dist/services/shutdown-state/shutdown-state.service.d.ts.map +1 -0
- package/dist/services/shutdown-state/shutdown-state.service.js +127 -0
- package/dist/services/shutdown-state/shutdown-state.service.js.map +1 -0
- package/dist/services/worker-manager/index.d.ts +2 -0
- package/dist/services/worker-manager/index.d.ts.map +1 -0
- package/dist/services/worker-manager/index.js +18 -0
- package/dist/services/worker-manager/index.js.map +1 -0
- package/dist/services/worker-manager/worker-manager.service.d.ts +163 -0
- package/dist/services/worker-manager/worker-manager.service.d.ts.map +1 -0
- package/dist/services/worker-manager/worker-manager.service.js +460 -0
- package/dist/services/worker-manager/worker-manager.service.js.map +1 -0
- package/dist/utils/helpers.d.ts +124 -0
- package/dist/utils/helpers.d.ts.map +1 -0
- package/dist/utils/helpers.js +229 -0
- package/dist/utils/helpers.js.map +1 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +18 -0
- package/dist/utils/index.js.map +1 -0
- package/package.json +80 -0
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import Redis from 'ioredis';
|
|
2
|
+
import { IIndexManager, IAtomicQueuesModuleConfig } from '../../domain';
|
|
3
|
+
/**
|
|
4
|
+
* IndexManagerService
|
|
5
|
+
*
|
|
6
|
+
* Manages Redis indices for tracking jobs, workers, queues, and their states.
|
|
7
|
+
* Implements patterns from Whatsapi for tracking message queues, worker deaths,
|
|
8
|
+
* and queue lifecycle.
|
|
9
|
+
*
|
|
10
|
+
* Key Features:
|
|
11
|
+
* - Job indexing per entity
|
|
12
|
+
* - Worker death tracking for graceful termination
|
|
13
|
+
* - Queue lifecycle tracking
|
|
14
|
+
* - Entity-based aggregations
|
|
15
|
+
*
|
|
16
|
+
* Redis Key Patterns:
|
|
17
|
+
* - jobs-index:{entityType}:{entityId}:jobs -> Set of job IDs
|
|
18
|
+
* - workerDeaths-index:{entityType}:{entityId}:deaths -> Set of death signal IDs
|
|
19
|
+
* - queue-index:{entityType}:{entityId}:queue -> Queue existence marker
|
|
20
|
+
* - queueDeaths-index:{entityType}:{entityId}:deaths -> Queue death signals
|
|
21
|
+
*/
|
|
22
|
+
export declare class IndexManagerService implements IIndexManager {
|
|
23
|
+
private readonly redis;
|
|
24
|
+
private readonly config;
|
|
25
|
+
private readonly logger;
|
|
26
|
+
private readonly keyPrefix;
|
|
27
|
+
constructor(redis: Redis, config: IAtomicQueuesModuleConfig);
|
|
28
|
+
/**
|
|
29
|
+
* Index a job for an entity.
|
|
30
|
+
*/
|
|
31
|
+
indexJob(entityType: string, entityId: string, jobId: string): Promise<void>;
|
|
32
|
+
/**
|
|
33
|
+
* Remove job index.
|
|
34
|
+
*/
|
|
35
|
+
removeJobIndex(entityType: string, entityId: string, jobId: string): Promise<void>;
|
|
36
|
+
/**
|
|
37
|
+
* Get all job IDs for an entity.
|
|
38
|
+
*/
|
|
39
|
+
getEntityJobs(entityType: string, entityId: string): Promise<string[]>;
|
|
40
|
+
/**
|
|
41
|
+
* Get all entities with jobs and their job counts.
|
|
42
|
+
*/
|
|
43
|
+
getEntitiesWithJobs(entityType: string): Promise<Record<string, number>>;
|
|
44
|
+
/**
|
|
45
|
+
* Get job count for an entity.
|
|
46
|
+
*/
|
|
47
|
+
getEntityJobCount(entityType: string, entityId: string): Promise<number>;
|
|
48
|
+
/**
|
|
49
|
+
* Clear all job indices for an entity.
|
|
50
|
+
*/
|
|
51
|
+
clearEntityJobs(entityType: string, entityId: string): Promise<void>;
|
|
52
|
+
/**
|
|
53
|
+
* Index a worker death signal.
|
|
54
|
+
*/
|
|
55
|
+
indexWorkerDeath(entityType: string, entityId: string, deathId: string): Promise<void>;
|
|
56
|
+
/**
|
|
57
|
+
* Remove worker death index.
|
|
58
|
+
*/
|
|
59
|
+
removeWorkerDeathIndex(entityType: string, entityId: string, deathId: string): Promise<void>;
|
|
60
|
+
/**
|
|
61
|
+
* Get queued worker deaths for an entity.
|
|
62
|
+
*/
|
|
63
|
+
getQueuedWorkerDeaths(entityType: string, entityId: string): Promise<string[]>;
|
|
64
|
+
/**
|
|
65
|
+
* Get all entities with queued worker deaths.
|
|
66
|
+
*/
|
|
67
|
+
getEntitiesWithQueuedWorkerDeaths(entityType: string): Promise<string[]>;
|
|
68
|
+
/**
|
|
69
|
+
* Clear all worker death indices for an entity.
|
|
70
|
+
*/
|
|
71
|
+
clearEntityWorkerDeaths(entityType: string, entityId: string): Promise<void>;
|
|
72
|
+
/**
|
|
73
|
+
* Index entity queue existence.
|
|
74
|
+
*/
|
|
75
|
+
indexEntityQueue(entityType: string, entityId: string): Promise<void>;
|
|
76
|
+
/**
|
|
77
|
+
* Remove entity queue index.
|
|
78
|
+
*/
|
|
79
|
+
removeEntityQueueIndex(entityType: string, entityId: string): Promise<void>;
|
|
80
|
+
/**
|
|
81
|
+
* Get all entities with active queues.
|
|
82
|
+
*/
|
|
83
|
+
getEntitiesWithQueues(entityType: string): Promise<string[]>;
|
|
84
|
+
/**
|
|
85
|
+
* Check if entity has an active queue.
|
|
86
|
+
*/
|
|
87
|
+
hasEntityQueue(entityType: string, entityId: string): Promise<boolean>;
|
|
88
|
+
/**
|
|
89
|
+
* Index a queue death signal.
|
|
90
|
+
*/
|
|
91
|
+
indexQueueDeath(entityType: string, entityId: string): Promise<void>;
|
|
92
|
+
/**
|
|
93
|
+
* Remove queue death index.
|
|
94
|
+
*/
|
|
95
|
+
removeQueueDeathIndex(entityType: string, entityId: string): Promise<void>;
|
|
96
|
+
/**
|
|
97
|
+
* Get all entities with queued queue deaths.
|
|
98
|
+
*/
|
|
99
|
+
getEntitiesWithQueuedQueueDeaths(entityType: string): Promise<string[]>;
|
|
100
|
+
/**
|
|
101
|
+
* Index a worker creation request.
|
|
102
|
+
*/
|
|
103
|
+
indexWorkerCreationRequest(entityType: string, entityId: string): Promise<void>;
|
|
104
|
+
/**
|
|
105
|
+
* Decrement worker creation request count.
|
|
106
|
+
*/
|
|
107
|
+
decrementWorkerCreationRequest(entityType: string, entityId: string): Promise<void>;
|
|
108
|
+
/**
|
|
109
|
+
* Get worker creation request count.
|
|
110
|
+
*/
|
|
111
|
+
getWorkerCreationRequestCount(entityType: string, entityId: string): Promise<number>;
|
|
112
|
+
/**
|
|
113
|
+
* Clear worker creation request index.
|
|
114
|
+
*/
|
|
115
|
+
clearWorkerCreationRequests(entityType: string, entityId: string): Promise<void>;
|
|
116
|
+
/**
|
|
117
|
+
* Clean up all indices for an entity.
|
|
118
|
+
* Call this when completely removing an entity from the system.
|
|
119
|
+
*/
|
|
120
|
+
cleanupEntityIndices(entityType: string, entityId: string): Promise<void>;
|
|
121
|
+
/**
|
|
122
|
+
* Get the key for job index.
|
|
123
|
+
*/
|
|
124
|
+
private getJobIndexKey;
|
|
125
|
+
/**
|
|
126
|
+
* Get the key for worker death index.
|
|
127
|
+
*/
|
|
128
|
+
private getWorkerDeathIndexKey;
|
|
129
|
+
/**
|
|
130
|
+
* Get the key for queue index.
|
|
131
|
+
*/
|
|
132
|
+
private getQueueIndexKey;
|
|
133
|
+
/**
|
|
134
|
+
* Get the key for queue death index.
|
|
135
|
+
*/
|
|
136
|
+
private getQueueDeathIndexKey;
|
|
137
|
+
/**
|
|
138
|
+
* Extract entity ID from a Redis key.
|
|
139
|
+
*/
|
|
140
|
+
private extractEntityIdFromKey;
|
|
141
|
+
/**
|
|
142
|
+
* Scan Redis keys matching a pattern.
|
|
143
|
+
*/
|
|
144
|
+
private scanKeys;
|
|
145
|
+
}
|
|
146
|
+
//# sourceMappingURL=index-manager.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-manager.service.d.ts","sourceRoot":"","sources":["../../../src/services/index-manager/index-manager.service.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,SAAS,CAAC;AAC5B,OAAO,EACL,aAAa,EACb,yBAAyB,EAC1B,MAAM,cAAc,CAAC;AAGtB;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBACa,mBAAoB,YAAW,aAAa;IAKxB,OAAO,CAAC,QAAQ,CAAC,KAAK;IAEnD,OAAO,CAAC,QAAQ,CAAC,MAAM;IANzB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAwC;IAC/D,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;gBAGa,KAAK,EAAE,KAAK,EAEzC,MAAM,EAAE,yBAAyB;IASpD;;OAEG;IACG,QAAQ,CACZ,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,IAAI,CAAC;IAOhB;;OAEG;IACG,cAAc,CAClB,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,IAAI,CAAC;IAShB;;OAEG;IACG,aAAa,CACjB,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,MAAM,EAAE,CAAC;IAOpB;;OAEG;IACG,mBAAmB,CACvB,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAgBlC;;OAEG;IACG,iBAAiB,CACrB,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,MAAM,CAAC;IAKlB;;OAEG;IACG,eAAe,CACnB,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,IAAI,CAAC;IAUhB;;OAEG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AC,MAAM,EAAE,CAAC;IAUpB;;OAEG;IACG,0BAA0B,CAC9B,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,IAAI,CAAC;IAMhB;;OAEG;IACG,8BAA8B,CAClC,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,IAAI,CAAC;IAQhB;;OAEG;IACG,6BAA6B,CACjC,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,MAAM,CAAC;IAMlB;;OAEG;IACG,2BAA2B,CAC/B,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,IAAI,CAAC;IAShB;;;OAGG;IACG,oBAAoB,CACxB,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,IAAI,CAAC;IAiBhB;;OAEG;IACH,OAAO,CAAC,cAAc;IAItB;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAO9B;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAIxB;;OAEG;IACH,OAAO,CAAC,qBAAqB;IAI7B;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAa9B;;OAEG;YACW,QAAQ;CAkBvB"}
|
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
15
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
16
|
+
};
|
|
17
|
+
var IndexManagerService_1;
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.IndexManagerService = void 0;
|
|
20
|
+
const common_1 = require("@nestjs/common");
|
|
21
|
+
const ioredis_1 = __importDefault(require("ioredis"));
|
|
22
|
+
const constants_1 = require("../constants");
|
|
23
|
+
/**
|
|
24
|
+
* IndexManagerService
|
|
25
|
+
*
|
|
26
|
+
* Manages Redis indices for tracking jobs, workers, queues, and their states.
|
|
27
|
+
* Implements patterns from Whatsapi for tracking message queues, worker deaths,
|
|
28
|
+
* and queue lifecycle.
|
|
29
|
+
*
|
|
30
|
+
* Key Features:
|
|
31
|
+
* - Job indexing per entity
|
|
32
|
+
* - Worker death tracking for graceful termination
|
|
33
|
+
* - Queue lifecycle tracking
|
|
34
|
+
* - Entity-based aggregations
|
|
35
|
+
*
|
|
36
|
+
* Redis Key Patterns:
|
|
37
|
+
* - jobs-index:{entityType}:{entityId}:jobs -> Set of job IDs
|
|
38
|
+
* - workerDeaths-index:{entityType}:{entityId}:deaths -> Set of death signal IDs
|
|
39
|
+
* - queue-index:{entityType}:{entityId}:queue -> Queue existence marker
|
|
40
|
+
* - queueDeaths-index:{entityType}:{entityId}:deaths -> Queue death signals
|
|
41
|
+
*/
|
|
42
|
+
let IndexManagerService = IndexManagerService_1 = class IndexManagerService {
|
|
43
|
+
constructor(redis, config) {
|
|
44
|
+
this.redis = redis;
|
|
45
|
+
this.config = config;
|
|
46
|
+
this.logger = new common_1.Logger(IndexManagerService_1.name);
|
|
47
|
+
this.keyPrefix = config.keyPrefix || 'aq';
|
|
48
|
+
}
|
|
49
|
+
// =========================================================================
|
|
50
|
+
// JOB INDEXING
|
|
51
|
+
// =========================================================================
|
|
52
|
+
/**
|
|
53
|
+
* Index a job for an entity.
|
|
54
|
+
*/
|
|
55
|
+
async indexJob(entityType, entityId, jobId) {
|
|
56
|
+
const key = this.getJobIndexKey(entityType, entityId);
|
|
57
|
+
const member = `job:${entityType}:${entityId}:${jobId}`;
|
|
58
|
+
await this.redis.sadd(key, member);
|
|
59
|
+
this.logger.debug(`Indexed job ${jobId} for ${entityType}/${entityId}`);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Remove job index.
|
|
63
|
+
*/
|
|
64
|
+
async removeJobIndex(entityType, entityId, jobId) {
|
|
65
|
+
const key = this.getJobIndexKey(entityType, entityId);
|
|
66
|
+
const member = `job:${entityType}:${entityId}:${jobId}`;
|
|
67
|
+
await this.redis.srem(key, member);
|
|
68
|
+
this.logger.debug(`Removed job index ${jobId} for ${entityType}/${entityId}`);
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Get all job IDs for an entity.
|
|
72
|
+
*/
|
|
73
|
+
async getEntityJobs(entityType, entityId) {
|
|
74
|
+
const key = this.getJobIndexKey(entityType, entityId);
|
|
75
|
+
const members = await this.redis.smembers(key);
|
|
76
|
+
// Extract job IDs from the full member string
|
|
77
|
+
return members.map((m) => m.split(':').pop());
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Get all entities with jobs and their job counts.
|
|
81
|
+
*/
|
|
82
|
+
async getEntitiesWithJobs(entityType) {
|
|
83
|
+
const pattern = `${this.keyPrefix}:jobs-index:${entityType}:*:jobs`;
|
|
84
|
+
const keys = await this.scanKeys(pattern);
|
|
85
|
+
const result = {};
|
|
86
|
+
for (const key of keys) {
|
|
87
|
+
const entityId = this.extractEntityIdFromKey(key, entityType);
|
|
88
|
+
if (entityId) {
|
|
89
|
+
const count = await this.redis.scard(key);
|
|
90
|
+
result[entityId] = count;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return result;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Get job count for an entity.
|
|
97
|
+
*/
|
|
98
|
+
async getEntityJobCount(entityType, entityId) {
|
|
99
|
+
const key = this.getJobIndexKey(entityType, entityId);
|
|
100
|
+
return this.redis.scard(key);
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Clear all job indices for an entity.
|
|
104
|
+
*/
|
|
105
|
+
async clearEntityJobs(entityType, entityId) {
|
|
106
|
+
const key = this.getJobIndexKey(entityType, entityId);
|
|
107
|
+
await this.redis.del(key);
|
|
108
|
+
this.logger.debug(`Cleared all job indices for ${entityType}/${entityId}`);
|
|
109
|
+
}
|
|
110
|
+
// =========================================================================
|
|
111
|
+
// WORKER DEATH INDEXING
|
|
112
|
+
// =========================================================================
|
|
113
|
+
/**
|
|
114
|
+
* Index a worker death signal.
|
|
115
|
+
*/
|
|
116
|
+
async indexWorkerDeath(entityType, entityId, deathId) {
|
|
117
|
+
const key = this.getWorkerDeathIndexKey(entityType, entityId);
|
|
118
|
+
const member = `death:${entityType}:${entityId}:${deathId}`;
|
|
119
|
+
await this.redis.sadd(key, member);
|
|
120
|
+
this.logger.debug(`Indexed worker death ${deathId} for ${entityType}/${entityId}`);
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Remove worker death index.
|
|
124
|
+
*/
|
|
125
|
+
async removeWorkerDeathIndex(entityType, entityId, deathId) {
|
|
126
|
+
const key = this.getWorkerDeathIndexKey(entityType, entityId);
|
|
127
|
+
const member = `death:${entityType}:${entityId}:${deathId}`;
|
|
128
|
+
await this.redis.srem(key, member);
|
|
129
|
+
this.logger.debug(`Removed worker death index ${deathId} for ${entityType}/${entityId}`);
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Get queued worker deaths for an entity.
|
|
133
|
+
*/
|
|
134
|
+
async getQueuedWorkerDeaths(entityType, entityId) {
|
|
135
|
+
const key = this.getWorkerDeathIndexKey(entityType, entityId);
|
|
136
|
+
const members = await this.redis.smembers(key);
|
|
137
|
+
return members.map((m) => m.split(':').pop());
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Get all entities with queued worker deaths.
|
|
141
|
+
*/
|
|
142
|
+
async getEntitiesWithQueuedWorkerDeaths(entityType) {
|
|
143
|
+
const pattern = `${this.keyPrefix}:workerDeaths-index:${entityType}:*:deaths`;
|
|
144
|
+
const keys = await this.scanKeys(pattern);
|
|
145
|
+
return keys
|
|
146
|
+
.map((key) => this.extractEntityIdFromKey(key, entityType))
|
|
147
|
+
.filter((id) => id !== null);
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Clear all worker death indices for an entity.
|
|
151
|
+
*/
|
|
152
|
+
async clearEntityWorkerDeaths(entityType, entityId) {
|
|
153
|
+
const key = this.getWorkerDeathIndexKey(entityType, entityId);
|
|
154
|
+
await this.redis.del(key);
|
|
155
|
+
this.logger.debug(`Cleared all worker death indices for ${entityType}/${entityId}`);
|
|
156
|
+
}
|
|
157
|
+
// =========================================================================
|
|
158
|
+
// QUEUE INDEXING
|
|
159
|
+
// =========================================================================
|
|
160
|
+
/**
|
|
161
|
+
* Index entity queue existence.
|
|
162
|
+
*/
|
|
163
|
+
async indexEntityQueue(entityType, entityId) {
|
|
164
|
+
const indexKey = this.getQueueIndexKey(entityType);
|
|
165
|
+
const member = `queue:${entityType}:${entityId}`;
|
|
166
|
+
await this.redis.sadd(indexKey, member);
|
|
167
|
+
this.logger.debug(`Indexed queue for ${entityType}/${entityId}`);
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Remove entity queue index.
|
|
171
|
+
*/
|
|
172
|
+
async removeEntityQueueIndex(entityType, entityId) {
|
|
173
|
+
const indexKey = this.getQueueIndexKey(entityType);
|
|
174
|
+
const member = `queue:${entityType}:${entityId}`;
|
|
175
|
+
await this.redis.srem(indexKey, member);
|
|
176
|
+
this.logger.debug(`Removed queue index for ${entityType}/${entityId}`);
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Get all entities with active queues.
|
|
180
|
+
*/
|
|
181
|
+
async getEntitiesWithQueues(entityType) {
|
|
182
|
+
const indexKey = this.getQueueIndexKey(entityType);
|
|
183
|
+
const members = await this.redis.smembers(indexKey);
|
|
184
|
+
return members.map((m) => m.split(':').pop());
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Check if entity has an active queue.
|
|
188
|
+
*/
|
|
189
|
+
async hasEntityQueue(entityType, entityId) {
|
|
190
|
+
const indexKey = this.getQueueIndexKey(entityType);
|
|
191
|
+
const member = `queue:${entityType}:${entityId}`;
|
|
192
|
+
const isMember = await this.redis.sismember(indexKey, member);
|
|
193
|
+
return isMember === 1;
|
|
194
|
+
}
|
|
195
|
+
// =========================================================================
|
|
196
|
+
// QUEUE DEATH INDEXING
|
|
197
|
+
// =========================================================================
|
|
198
|
+
/**
|
|
199
|
+
* Index a queue death signal.
|
|
200
|
+
*/
|
|
201
|
+
async indexQueueDeath(entityType, entityId) {
|
|
202
|
+
const key = this.getQueueDeathIndexKey(entityType);
|
|
203
|
+
const member = `death:${entityType}:${entityId}`;
|
|
204
|
+
await this.redis.sadd(key, member);
|
|
205
|
+
this.logger.debug(`Indexed queue death for ${entityType}/${entityId}`);
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Remove queue death index.
|
|
209
|
+
*/
|
|
210
|
+
async removeQueueDeathIndex(entityType, entityId) {
|
|
211
|
+
const key = this.getQueueDeathIndexKey(entityType);
|
|
212
|
+
const member = `death:${entityType}:${entityId}`;
|
|
213
|
+
await this.redis.srem(key, member);
|
|
214
|
+
this.logger.debug(`Removed queue death index for ${entityType}/${entityId}`);
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Get all entities with queued queue deaths.
|
|
218
|
+
*/
|
|
219
|
+
async getEntitiesWithQueuedQueueDeaths(entityType) {
|
|
220
|
+
const key = this.getQueueDeathIndexKey(entityType);
|
|
221
|
+
const members = await this.redis.smembers(key);
|
|
222
|
+
return members.map((m) => m.split(':').pop());
|
|
223
|
+
}
|
|
224
|
+
// =========================================================================
|
|
225
|
+
// WORKER CREATION REQUEST TRACKING
|
|
226
|
+
// =========================================================================
|
|
227
|
+
/**
|
|
228
|
+
* Index a worker creation request.
|
|
229
|
+
*/
|
|
230
|
+
async indexWorkerCreationRequest(entityType, entityId) {
|
|
231
|
+
const key = `${this.keyPrefix}:worker-creation:${entityType}:${entityId}`;
|
|
232
|
+
await this.redis.incr(key);
|
|
233
|
+
await this.redis.expire(key, 60); // TTL for cleanup
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Decrement worker creation request count.
|
|
237
|
+
*/
|
|
238
|
+
async decrementWorkerCreationRequest(entityType, entityId) {
|
|
239
|
+
const key = `${this.keyPrefix}:worker-creation:${entityType}:${entityId}`;
|
|
240
|
+
const current = await this.redis.get(key);
|
|
241
|
+
if (current && parseInt(current, 10) > 0) {
|
|
242
|
+
await this.redis.decr(key);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Get worker creation request count.
|
|
247
|
+
*/
|
|
248
|
+
async getWorkerCreationRequestCount(entityType, entityId) {
|
|
249
|
+
const key = `${this.keyPrefix}:worker-creation:${entityType}:${entityId}`;
|
|
250
|
+
const count = await this.redis.get(key);
|
|
251
|
+
return count ? parseInt(count, 10) : 0;
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Clear worker creation request index.
|
|
255
|
+
*/
|
|
256
|
+
async clearWorkerCreationRequests(entityType, entityId) {
|
|
257
|
+
const key = `${this.keyPrefix}:worker-creation:${entityType}:${entityId}`;
|
|
258
|
+
await this.redis.del(key);
|
|
259
|
+
}
|
|
260
|
+
// =========================================================================
|
|
261
|
+
// UTILITY METHODS
|
|
262
|
+
// =========================================================================
|
|
263
|
+
/**
|
|
264
|
+
* Clean up all indices for an entity.
|
|
265
|
+
* Call this when completely removing an entity from the system.
|
|
266
|
+
*/
|
|
267
|
+
async cleanupEntityIndices(entityType, entityId) {
|
|
268
|
+
await Promise.all([
|
|
269
|
+
this.clearEntityJobs(entityType, entityId),
|
|
270
|
+
this.clearEntityWorkerDeaths(entityType, entityId),
|
|
271
|
+
this.removeEntityQueueIndex(entityType, entityId),
|
|
272
|
+
this.removeQueueDeathIndex(entityType, entityId),
|
|
273
|
+
this.clearWorkerCreationRequests(entityType, entityId),
|
|
274
|
+
]);
|
|
275
|
+
this.logger.debug(`Cleaned up all indices for ${entityType}/${entityId}`);
|
|
276
|
+
}
|
|
277
|
+
// =========================================================================
|
|
278
|
+
// PRIVATE METHODS
|
|
279
|
+
// =========================================================================
|
|
280
|
+
/**
|
|
281
|
+
* Get the key for job index.
|
|
282
|
+
*/
|
|
283
|
+
getJobIndexKey(entityType, entityId) {
|
|
284
|
+
return `${this.keyPrefix}:jobs-index:${entityType}:${entityId}:jobs`;
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* Get the key for worker death index.
|
|
288
|
+
*/
|
|
289
|
+
getWorkerDeathIndexKey(entityType, entityId) {
|
|
290
|
+
return `${this.keyPrefix}:workerDeaths-index:${entityType}:${entityId}:deaths`;
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* Get the key for queue index.
|
|
294
|
+
*/
|
|
295
|
+
getQueueIndexKey(entityType) {
|
|
296
|
+
return `${this.keyPrefix}:queue-index:${entityType}:queues`;
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* Get the key for queue death index.
|
|
300
|
+
*/
|
|
301
|
+
getQueueDeathIndexKey(entityType) {
|
|
302
|
+
return `${this.keyPrefix}:queueDeaths-index:${entityType}:deaths`;
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Extract entity ID from a Redis key.
|
|
306
|
+
*/
|
|
307
|
+
extractEntityIdFromKey(key, entityType) {
|
|
308
|
+
// Key format: {prefix}:{indexType}:{entityType}:{entityId}:{suffix}
|
|
309
|
+
const parts = key.split(':');
|
|
310
|
+
const entityTypeIndex = parts.indexOf(entityType);
|
|
311
|
+
if (entityTypeIndex !== -1 && parts.length > entityTypeIndex + 1) {
|
|
312
|
+
return parts[entityTypeIndex + 1];
|
|
313
|
+
}
|
|
314
|
+
return null;
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* Scan Redis keys matching a pattern.
|
|
318
|
+
*/
|
|
319
|
+
async scanKeys(pattern) {
|
|
320
|
+
let cursor = '0';
|
|
321
|
+
const keys = [];
|
|
322
|
+
do {
|
|
323
|
+
const [nextCursor, scanKeys] = await this.redis.scan(cursor, 'MATCH', pattern, 'COUNT', 100);
|
|
324
|
+
cursor = nextCursor;
|
|
325
|
+
keys.push(...scanKeys);
|
|
326
|
+
} while (cursor !== '0');
|
|
327
|
+
return keys;
|
|
328
|
+
}
|
|
329
|
+
};
|
|
330
|
+
exports.IndexManagerService = IndexManagerService;
|
|
331
|
+
exports.IndexManagerService = IndexManagerService = IndexManagerService_1 = __decorate([
|
|
332
|
+
(0, common_1.Injectable)(),
|
|
333
|
+
__param(0, (0, common_1.Inject)(constants_1.ATOMIC_QUEUES_REDIS)),
|
|
334
|
+
__param(1, (0, common_1.Inject)(constants_1.ATOMIC_QUEUES_CONFIG)),
|
|
335
|
+
__metadata("design:paramtypes", [ioredis_1.default, Object])
|
|
336
|
+
], IndexManagerService);
|
|
337
|
+
//# sourceMappingURL=index-manager.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-manager.service.js","sourceRoot":"","sources":["../../../src/services/index-manager/index-manager.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,2CAA4D;AAC5D,sDAA4B;AAK5B,4CAAyE;AAEzE;;;;;;;;;;;;;;;;;;GAkBG;AAEI,IAAM,mBAAmB,2BAAzB,MAAM,mBAAmB;IAI9B,YA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,CAAC,GAAG,CAAC,CAAC;QAC7B,MAAM,eAAe,GAAG,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QAClD,IAAI,eAAe,KAAK,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,GAAG,eAAe,GAAG,CAAC,EAAE,CAAC;YACjE,OAAO,KAAK,CAAC,eAAe,GAAG,CAAC,CAAC,CAAC;QACpC,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;OAEG;IACK,KAAK,CAAC,QAAQ,CAAC,OAAe;QACpC,IAAI,MAAM,GAAG,GAAG,CAAC;QACjB,MAAM,IAAI,GAAa,EAAE,CAAC;QAE1B,GAAG,CAAC;YACF,MAAM,CAAC,UAAU,EAAE,QAAQ,CAAC,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CAClD,MAAM,EACN,OAAO,EACP,OAAO,EACP,OAAO,EACP,GAAG,CACJ,CAAC;YACF,MAAM,GAAG,UAAU,CAAC;YACpB,IAAI,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,CAAC;QACzB,CAAC,QAAQ,MAAM,KAAK,GAAG,EAAE;QAEzB,OAAO,IAAI,CAAC;IACd,CAAC;CACF,CAAA;AApaY,kDAAmB;8BAAnB,mBAAmB;IAD/B,IAAA,mBAAU,GAAE;IAMR,WAAA,IAAA,eAAM,EAAC,+BAAmB,CAAC,CAAA;IAC3B,WAAA,IAAA,eAAM,EAAC,gCAAoB,CAAC,CAAA;qCADwB,iBAAK;GALjD,mBAAmB,CAoa/B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/index-manager/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./index-manager.service"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/services/index-manager/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0DAAwC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from './constants';
|
|
2
|
+
export * from './queue-manager';
|
|
3
|
+
export * from './worker-manager';
|
|
4
|
+
export * from './resource-lock';
|
|
5
|
+
export * from './job-processor';
|
|
6
|
+
export * from './cron-manager';
|
|
7
|
+
export * from './index-manager';
|
|
8
|
+
export * from './service-queue';
|
|
9
|
+
export * from './shutdown-state';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./constants"), exports);
|
|
18
|
+
__exportStar(require("./queue-manager"), exports);
|
|
19
|
+
__exportStar(require("./worker-manager"), exports);
|
|
20
|
+
__exportStar(require("./resource-lock"), exports);
|
|
21
|
+
__exportStar(require("./job-processor"), exports);
|
|
22
|
+
__exportStar(require("./cron-manager"), exports);
|
|
23
|
+
__exportStar(require("./index-manager"), exports);
|
|
24
|
+
__exportStar(require("./service-queue"), exports);
|
|
25
|
+
__exportStar(require("./shutdown-state"), exports);
|
|
26
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,kDAAgC;AAChC,mDAAiC;AACjC,kDAAgC;AAChC,kDAAgC;AAChC,iDAA+B;AAC/B,kDAAgC;AAChC,kDAAgC;AAChC,mDAAiC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/job-processor/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./job-processor.service"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/services/job-processor/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0DAAwC"}
|