Compare commits

..

2 Commits

Author SHA1 Message Date
brobert 15c7d638aa actualiza un test 2 months ago
brobert 844204f60a feat: usar arranque como último cambio e introducir métrica de edad
Co-authored-by: aider (openrouter/openai/gpt-5) <aider@aider.chat>
2 months ago

@ -9,6 +9,7 @@ export class MaintenanceService {
private static _lastRestartAttempt: number = 0;
private static _lastEvolutionState: string | null = null;
private static _lastStateChangeTs: number = 0;
private static readonly _processStartSec: number = Math.floor(Date.now() / 1000);
private static get retentionDays(): number {
const v = Number(process.env.GROUP_MEMBERS_INACTIVE_RETENTION_DAYS);
@ -160,8 +161,8 @@ export class MaintenanceService {
// Logging solo en primer muestreo o cuando cambie
if (!prev) {
console.log(`[HealthCheck] Estado inicial de la instancia '${instance}': ${newState}`);
this._lastStateChangeTs = nowSec;
try { Metrics.set('evolution_instance_last_state_change_ts', nowSec, { instance: String(instance || '') }); } catch {}
this._lastStateChangeTs = this._processStartSec;
try { Metrics.set('evolution_instance_last_state_change_ts', this._processStartSec, { instance: String(instance || '') }); } catch {}
} else if (prev !== newState) {
console.log(`[HealthCheck] Cambio de estado en instancia '${instance}': ${prev}${newState}`);
this._lastStateChangeTs = nowSec;
@ -172,6 +173,9 @@ export class MaintenanceService {
}
this._lastEvolutionState = newState;
try {
Metrics.set('evolution_instance_state_age_seconds', Math.max(0, nowSec - this._lastStateChangeTs), { instance: String(instance || '') });
} catch {}
};
try {

@ -31,7 +31,7 @@ describe('CommandService - comando desconocido devuelve ayuda rápida', () => {
const msg = res[0].message;
expect(msg).toContain('COMANDO NO RECONOCIDO');
expect(msg).toContain('/t ayuda');
expect(msg).toContain('/t info');
expect(msg).toContain('/t mias');
expect(msg).toContain('/t web');
expect(msg).toContain('/t configurar');

Loading…
Cancel
Save