@hotmeshio/long-tail 0.2.4 → 0.2.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.
|
@@ -69,7 +69,13 @@ declare class LTCronRegistry {
|
|
|
69
69
|
*/
|
|
70
70
|
connectAgentCrons(): Promise<void>;
|
|
71
71
|
/**
|
|
72
|
-
*
|
|
72
|
+
* Disconnect on graceful shutdown. Clears the local registry so this
|
|
73
|
+
* container stops consuming cron streams. Does NOT call Virtual.interrupt()
|
|
74
|
+
* — cron jobs are durable rows shared across the fleet. Another container
|
|
75
|
+
* (or this one on restart) will continue servicing them.
|
|
76
|
+
*
|
|
77
|
+
* Use stopCron/stopAgentCrons/stopYamlCron for intentional permanent kills
|
|
78
|
+
* (e.g. user deletes an agent or changes a schedule via the dashboard).
|
|
73
79
|
*/
|
|
74
80
|
disconnect(): Promise<void>;
|
|
75
81
|
/**
|
|
@@ -444,21 +444,16 @@ class LTCronRegistry {
|
|
|
444
444
|
logger_1.loggerRegistry.info(`[lt-cron] ${armed} agent schedule(s) armed`);
|
|
445
445
|
}
|
|
446
446
|
/**
|
|
447
|
-
*
|
|
447
|
+
* Disconnect on graceful shutdown. Clears the local registry so this
|
|
448
|
+
* container stops consuming cron streams. Does NOT call Virtual.interrupt()
|
|
449
|
+
* — cron jobs are durable rows shared across the fleet. Another container
|
|
450
|
+
* (or this one on restart) will continue servicing them.
|
|
451
|
+
*
|
|
452
|
+
* Use stopCron/stopAgentCrons/stopYamlCron for intentional permanent kills
|
|
453
|
+
* (e.g. user deletes an agent or changes a schedule via the dashboard).
|
|
448
454
|
*/
|
|
449
455
|
async disconnect() {
|
|
450
|
-
|
|
451
|
-
if (key.startsWith('agent:')) {
|
|
452
|
-
const agentId = key.split(':')[1].split('-')[0];
|
|
453
|
-
await this.stopAgentCrons(agentId);
|
|
454
|
-
}
|
|
455
|
-
else if (key.startsWith('yaml:')) {
|
|
456
|
-
await this.stopYamlCron(key.replace('yaml:', ''));
|
|
457
|
-
}
|
|
458
|
-
else {
|
|
459
|
-
await this.stopCron(key);
|
|
460
|
-
}
|
|
461
|
-
}
|
|
456
|
+
this.activeCrons.clear();
|
|
462
457
|
this.connected = false;
|
|
463
458
|
}
|
|
464
459
|
/**
|
|
@@ -22,7 +22,9 @@ declare class LTMaintenanceRegistry {
|
|
|
22
22
|
*/
|
|
23
23
|
connect(): Promise<void>;
|
|
24
24
|
/**
|
|
25
|
-
*
|
|
25
|
+
* Disconnect on graceful shutdown. Stops consuming but leaves the cron
|
|
26
|
+
* row alive — it's a durable job shared across the fleet. Another
|
|
27
|
+
* container (or this one on restart) will continue servicing it.
|
|
26
28
|
*/
|
|
27
29
|
disconnect(): Promise<void>;
|
|
28
30
|
/**
|
|
@@ -140,22 +140,11 @@ class LTMaintenanceRegistry {
|
|
|
140
140
|
logger_1.loggerRegistry.info(`[lt-maintenance] cron started (schedule: ${schedule})`);
|
|
141
141
|
}
|
|
142
142
|
/**
|
|
143
|
-
*
|
|
143
|
+
* Disconnect on graceful shutdown. Stops consuming but leaves the cron
|
|
144
|
+
* row alive — it's a durable job shared across the fleet. Another
|
|
145
|
+
* container (or this one on restart) will continue servicing it.
|
|
144
146
|
*/
|
|
145
147
|
async disconnect() {
|
|
146
|
-
if (!this.connected)
|
|
147
|
-
return;
|
|
148
|
-
try {
|
|
149
|
-
const connection = (0, db_1.getConnection)();
|
|
150
|
-
await hotmesh_1.Virtual.interrupt({
|
|
151
|
-
topic: CRON_TOPIC,
|
|
152
|
-
connection,
|
|
153
|
-
options: { id: CRON_ID },
|
|
154
|
-
});
|
|
155
|
-
}
|
|
156
|
-
catch (err) {
|
|
157
|
-
logger_1.loggerRegistry.warn(`[lt-maintenance] interrupt failed (may not be running): ${err?.message}`);
|
|
158
|
-
}
|
|
159
148
|
this.connected = false;
|
|
160
149
|
}
|
|
161
150
|
/**
|
package/package.json
CHANGED