feat: schedule heavy jobs for the night
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SfihHazrSHXgndJtSNLubJ
This commit is contained in:
parent
31a9be4c26
commit
8d9a04937a
9 changed files with 145 additions and 12 deletions
|
|
@ -100,3 +100,5 @@ form.send { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--lin
|
||||||
.inbox { margin: 10px 0 4px; line-height: 1.9; }
|
.inbox { margin: 10px 0 4px; line-height: 1.9; }
|
||||||
.inbox:empty { display: none; }
|
.inbox:empty { display: none; }
|
||||||
.followup { margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--line); }
|
.followup { margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--line); }
|
||||||
|
.running.scheduled { background: transparent; border: 1px dashed var(--line); }
|
||||||
|
.moon { width: 18px; height: 18px; border-radius: 50%; box-shadow: inset -5px -3px 0 0 var(--accent); flex: none; transform: rotate(-20deg); }
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,8 @@
|
||||||
const hot = s.temp !== null && s.temp >= s.thermalMax - 5;
|
const hot = s.temp !== null && s.temp >= s.thermalMax - 5;
|
||||||
el.innerHTML = `${s.temp !== null ? `<span class="${hot ? 'warn' : ''}">${s.temp} °C</span>` : ''}
|
el.innerHTML = `${s.temp !== null ? `<span class="${hot ? 'warn' : ''}">${s.temp} °C</span>` : ''}
|
||||||
<span title="Équivalent API, consommé sur ton quota Pro">IA 24 h : $${s.usage.day.cost.toFixed(2)} · 30 j : $${s.usage.month.cost.toFixed(2)}</span>
|
<span title="Équivalent API, consommé sur ton quota Pro">IA 24 h : $${s.usage.day.cost.toFixed(2)} · 30 j : $${s.usage.month.cost.toFixed(2)}</span>
|
||||||
${s.queue ? `<span class="spin-inline"></span>${s.queue} job(s)` : ''}`;
|
${s.queue ? `<span class="spin-inline"></span>${s.queue} job(s)` : ''}
|
||||||
|
${s.scheduled ? `<span>${s.scheduled} programmé(s) cette nuit</span>` : ''}`;
|
||||||
} catch { /* silencieux */ }
|
} catch { /* silencieux */ }
|
||||||
}
|
}
|
||||||
refreshSys();
|
refreshSys();
|
||||||
|
|
@ -55,6 +56,13 @@
|
||||||
if (!box) return;
|
if (!box) return;
|
||||||
if (!job) { box.innerHTML = ''; return; }
|
if (!job) { box.innerHTML = ''; return; }
|
||||||
const p = job.progress || {};
|
const p = job.progress || {};
|
||||||
|
if (job.status === 'queued' && job.runAfter && job.runAfter * 1000 > Date.now()) {
|
||||||
|
const at = new Date(job.runAfter * 1000).toLocaleString('fr-FR', { weekday: 'long', hour: '2-digit', minute: '2-digit', timeZone: 'Europe/Paris' });
|
||||||
|
box.innerHTML = `<div class="running scheduled"><span class="moon" aria-hidden="true"></span>
|
||||||
|
<div><div>${LABELS[type]} programmé(e) : ${esc(at)}</div><div class="small muted">Le Pi est au frais et ton quota Claude est libre.</div></div>
|
||||||
|
<button class="btn small" data-cancel="${job.id}">Annuler</button></div>`;
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (ACTIVE.includes(job.status)) {
|
if (ACTIVE.includes(job.status)) {
|
||||||
const extra = type === 'prospect' && p.found !== undefined
|
const extra = type === 'prospect' && p.found !== undefined
|
||||||
? `<strong>${p.found}</strong> prospect(s) trouvé(s) sur ${p.target}` : '';
|
? `<strong>${p.found}</strong> prospect(s) trouvé(s) sur ${p.target}` : '';
|
||||||
|
|
@ -247,10 +255,16 @@
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'target': await api(`/api/projects/${id}/target`, data); toast('Cible validée'); setTimeout(() => location.reload(), 500); break;
|
case 'target': await api(`/api/projects/${id}/target`, data); toast('Cible validée'); setTimeout(() => location.reload(), 500); break;
|
||||||
case 'prospect': await api(`/api/projects/${id}/prospect`, data); toast('Recherche lancée en arrière-plan'); break;
|
case 'prospect': {
|
||||||
|
const r = await api(`/api/projects/${id}/prospect`, data);
|
||||||
|
toast(r.existing ? 'Une recherche est déjà prévue ou en cours' : data.when === 'night' ? 'Recherche programmée cette nuit' : 'Recherche lancée en arrière-plan');
|
||||||
|
break;
|
||||||
|
}
|
||||||
case 'evolution': {
|
case 'evolution': {
|
||||||
if (data.level === 'approfondi' && !confirm('Le niveau approfondi utilise Opus et consomme beaucoup de quota. Continuer ?')) break;
|
if (data.level === 'approfondi' && !confirm('Le niveau approfondi utilise Opus et consomme beaucoup de quota. Continuer ?')) break;
|
||||||
await api(`/api/projects/${id}/evolution`, data); toast('Recherche d\'évolutions lancée'); break;
|
const r = await api(`/api/projects/${id}/evolution`, data);
|
||||||
|
toast(r.existing ? 'Une recherche est déjà prévue ou en cours' : data.when === 'night' ? 'Évolutions programmées cette nuit' : 'Recherche d\'évolutions lancée');
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
case 'template': {
|
case 'template': {
|
||||||
data.kind = form.dataset.kind;
|
data.kind = form.dataset.kind;
|
||||||
|
|
|
||||||
|
|
@ -101,6 +101,10 @@ export const MIGRATIONS = [
|
||||||
ALTER TABLE projects ADD COLUMN followup_enabled INTEGER NOT NULL DEFAULT 0;
|
ALTER TABLE projects ADD COLUMN followup_enabled INTEGER NOT NULL DEFAULT 0;
|
||||||
ALTER TABLE projects ADD COLUMN followup_days INTEGER NOT NULL DEFAULT 7;
|
ALTER TABLE projects ADD COLUMN followup_days INTEGER NOT NULL DEFAULT 7;
|
||||||
`,
|
`,
|
||||||
|
// 6 — jobs programmés (la nuit)
|
||||||
|
`
|
||||||
|
ALTER TABLE jobs ADD COLUMN run_after INTEGER; -- ne pas démarrer avant (epoch s)
|
||||||
|
`,
|
||||||
];
|
];
|
||||||
|
|
||||||
export function openDb(dataDir) {
|
export function openDb(dataDir) {
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ import { allowedToSend, EMAIL_RE } from './services/mailer.js';
|
||||||
import { cpuTemp } from './services/thermal.js';
|
import { cpuTemp } from './services/thermal.js';
|
||||||
import { checkInbox } from './services/inbox.js';
|
import { checkInbox } from './services/inbox.js';
|
||||||
import { followupPlan } from './services/followup.js';
|
import { followupPlan } from './services/followup.js';
|
||||||
|
import { nextNightSlot } from './services/paris-time.js';
|
||||||
import {
|
import {
|
||||||
getProject, listProjects, createProject, saveSecretConfig, publicConfig, globalSmtp,
|
getProject, listProjects, createProject, saveSecretConfig, publicConfig, globalSmtp,
|
||||||
prospectStats, sentSince, repoDir, getTemplate, saveTemplate, abStats,
|
prospectStats, sentSince, repoDir, getTemplate, saveTemplate, abStats,
|
||||||
|
|
@ -94,8 +95,10 @@ export function registerRoutes(router, app) {
|
||||||
|
|
||||||
// ---------- API JSON ----------
|
// ---------- API JSON ----------
|
||||||
router.get('/api/system', ({ res }) => {
|
router.get('/api/system', ({ res }) => {
|
||||||
const queue = db.prepare("SELECT COUNT(*) n FROM jobs WHERE status IN ('queued','running')").get().n;
|
const queue = db.prepare(`SELECT COUNT(*) n FROM jobs WHERE status = 'running'
|
||||||
json(res, { temp: cpuTemp(), queue, usage: usageSummary(db), thermalMax: cfg.thermalMax });
|
OR (status = 'queued' AND (run_after IS NULL OR run_after <= ?))`).get(now()).n;
|
||||||
|
const scheduled = db.prepare("SELECT COUNT(*) n FROM jobs WHERE status = 'queued' AND run_after > ?").get(now()).n;
|
||||||
|
json(res, { temp: cpuTemp(), queue, scheduled, usage: usageSummary(db), thermalMax: cfg.thermalMax });
|
||||||
});
|
});
|
||||||
|
|
||||||
router.post('/api/projects', async ({ req, res }) => {
|
router.post('/api/projects', async ({ req, res }) => {
|
||||||
|
|
@ -161,7 +164,9 @@ export function registerRoutes(router, app) {
|
||||||
const p = getProject(app, pid(params));
|
const p = getProject(app, pid(params));
|
||||||
const b = req.headers['content-type']?.includes('json') ? await readBody(req) : {};
|
const b = req.headers['content-type']?.includes('json') ? await readBody(req) : {};
|
||||||
guard(p, b);
|
guard(p, b);
|
||||||
const r = enqueue(db, { projectId: p.id, type, params: paramsOf(b) });
|
// "Cette nuit" : démarrage au prochain créneau 1h-6h (Pi au frais, quota Claude libre)
|
||||||
|
const runAfter = b.when === 'night' ? Math.floor(nextNightSlot().getTime() / 1000) : null;
|
||||||
|
const r = enqueue(db, { projectId: p.id, type, params: paramsOf(b), runAfter });
|
||||||
json(res, r);
|
json(res, r);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,13 +2,13 @@
|
||||||
import { now } from '../db.js';
|
import { now } from '../db.js';
|
||||||
import { waitCool } from './thermal.js';
|
import { waitCool } from './thermal.js';
|
||||||
|
|
||||||
export function enqueue(db, { projectId, type, params = {} }) {
|
export function enqueue(db, { projectId, type, params = {}, runAfter = null }) {
|
||||||
const running = db.prepare(
|
const running = db.prepare(
|
||||||
"SELECT id FROM jobs WHERE project_id IS ? AND type = ? AND status IN ('queued','running')"
|
"SELECT id FROM jobs WHERE project_id IS ? AND type = ? AND status IN ('queued','running')"
|
||||||
).get(projectId ?? null, type);
|
).get(projectId ?? null, type);
|
||||||
if (running) return { id: running.id, existing: true };
|
if (running) return { id: running.id, existing: true };
|
||||||
const r = db.prepare('INSERT INTO jobs(project_id, type, params_json, created_at) VALUES(?, ?, ?, ?)')
|
const r = db.prepare('INSERT INTO jobs(project_id, type, params_json, created_at, run_after) VALUES(?, ?, ?, ?, ?)')
|
||||||
.run(projectId ?? null, type, JSON.stringify(params), now());
|
.run(projectId ?? null, type, JSON.stringify(params), now(), runAfter);
|
||||||
return { id: Number(r.lastInsertRowid), existing: false };
|
return { id: Number(r.lastInsertRowid), existing: false };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -32,14 +32,15 @@ export function latestJobs(db, projectId) {
|
||||||
id: r.id, status: r.status, error: r.error,
|
id: r.id, status: r.status, error: r.error,
|
||||||
progress: r.progress_json ? JSON.parse(r.progress_json) : null,
|
progress: r.progress_json ? JSON.parse(r.progress_json) : null,
|
||||||
result: r.result_json ? JSON.parse(r.result_json) : null,
|
result: r.result_json ? JSON.parse(r.result_json) : null,
|
||||||
createdAt: r.created_at, finishedAt: r.finished_at,
|
createdAt: r.created_at, finishedAt: r.finished_at, runAfter: r.run_after,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Worker {
|
export class Worker {
|
||||||
constructor(db, handlers, { thermalMax = 75, pollMs = 3000, log = console } = {}) {
|
constructor(db, handlers, { thermalMax = 75, pollMs = 3000, log = console, clock = now } = {}) {
|
||||||
|
this.clock = clock;
|
||||||
this.db = db;
|
this.db = db;
|
||||||
this.handlers = handlers;
|
this.handlers = handlers;
|
||||||
this.thermalMax = thermalMax;
|
this.thermalMax = thermalMax;
|
||||||
|
|
@ -69,7 +70,8 @@ export class Worker {
|
||||||
}
|
}
|
||||||
|
|
||||||
async tick() {
|
async tick() {
|
||||||
const job = this.db.prepare("SELECT * FROM jobs WHERE status = 'queued' ORDER BY id LIMIT 1").get();
|
const job = this.db.prepare(`SELECT * FROM jobs WHERE status = 'queued'
|
||||||
|
AND (run_after IS NULL OR run_after <= ?) ORDER BY id LIMIT 1`).get(this.clock());
|
||||||
if (!job) return false;
|
if (!job) return false;
|
||||||
const handler = this.handlers[job.type];
|
const handler = this.handlers[job.type];
|
||||||
if (!handler) {
|
if (!handler) {
|
||||||
|
|
|
||||||
48
src/services/paris-time.js
Normal file
48
src/services/paris-time.js
Normal file
|
|
@ -0,0 +1,48 @@
|
||||||
|
// Heures "murales" de Paris, changements d'heure compris. Aucune dépendance.
|
||||||
|
const TZ = 'Europe/Paris';
|
||||||
|
|
||||||
|
const partsFmt = new Intl.DateTimeFormat('en-GB', {
|
||||||
|
timeZone: TZ, year: 'numeric', month: '2-digit', day: '2-digit',
|
||||||
|
hour: '2-digit', minute: '2-digit', weekday: 'short', hourCycle: 'h23',
|
||||||
|
});
|
||||||
|
const offsetFmt = new Intl.DateTimeFormat('en-US', { timeZone: TZ, timeZoneName: 'shortOffset' });
|
||||||
|
|
||||||
|
/** @returns {{year:number, month:number, day:number, hour:number, minute:number, weekday:string}} */
|
||||||
|
export function parisParts(date = new Date()) {
|
||||||
|
const p = Object.fromEntries(partsFmt.formatToParts(date).map((x) => [x.type, x.value]));
|
||||||
|
return { year: +p.year, month: +p.month, day: +p.day, hour: +p.hour % 24, minute: +p.minute, weekday: p.weekday };
|
||||||
|
}
|
||||||
|
|
||||||
|
// Décalage de Paris par rapport à UTC à un instant donné, en minutes (+60 l'hiver, +120 l'été)
|
||||||
|
function offsetMinutes(date) {
|
||||||
|
const name = offsetFmt.formatToParts(date).find((x) => x.type === 'timeZoneName')?.value || 'GMT';
|
||||||
|
const m = /GMT([+-])(\d{1,2})(?::(\d{2}))?/.exec(name);
|
||||||
|
return m ? (m[1] === '-' ? -1 : 1) * (Number(m[2]) * 60 + Number(m[3] || 0)) : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Heure murale à Paris → instant. */
|
||||||
|
export function parisTime(year, month, day, hour, minute = 0) {
|
||||||
|
const guess = Date.UTC(year, month - 1, day, hour, minute);
|
||||||
|
let t = guess - offsetMinutes(new Date(guess)) * 60_000;
|
||||||
|
t = guess - offsetMinutes(new Date(t)) * 60_000; // 2e passe : correct autour du changement d'heure
|
||||||
|
return new Date(t);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Même heure murale, N jours plus tard. */
|
||||||
|
export function addParisDays(date, days) {
|
||||||
|
const p = parisParts(date);
|
||||||
|
const noon = parisTime(p.year, p.month, p.day, 12);
|
||||||
|
const q = parisParts(new Date(noon.getTime() + days * 86_400_000));
|
||||||
|
return { year: q.year, month: q.month, day: q.day };
|
||||||
|
}
|
||||||
|
|
||||||
|
// Créneau de nuit : le Pi est au frais et le quota Claude n'est pas utilisé par toi
|
||||||
|
export const NIGHT = { start: 1, end: 6 };
|
||||||
|
|
||||||
|
/** Prochain début de créneau de nuit (ou maintenant si on y est déjà). */
|
||||||
|
export function nextNightSlot(date = new Date()) {
|
||||||
|
const p = parisParts(date);
|
||||||
|
if (p.hour >= NIGHT.start && p.hour < NIGHT.end) return date;
|
||||||
|
const d = p.hour < NIGHT.start ? p : addParisDays(date, 1);
|
||||||
|
return parisTime(d.year, d.month, d.day, NIGHT.start);
|
||||||
|
}
|
||||||
|
|
@ -151,6 +151,7 @@ function projectItem(p, smtp, dbCfg, imap) {
|
||||||
<section class="panel" data-panel-body="prospect" hidden>
|
<section class="panel" data-panel-body="prospect" hidden>
|
||||||
<form data-action="prospect" data-id="${p.id}" class="inline">
|
<form data-action="prospect" data-id="${p.id}" class="inline">
|
||||||
<label>Prospects à chercher<input name="count" type="number" min="1" max="50" value="10"></label>
|
<label>Prospects à chercher<input name="count" type="number" min="1" max="50" value="10"></label>
|
||||||
|
<label>Quand<select name="when"><option value="now">Maintenant</option><option value="night">Cette nuit (1h-6h)</option></select></label>
|
||||||
<button class="btn primary">Lancer la recherche</button>
|
<button class="btn primary">Lancer la recherche</button>
|
||||||
</form>
|
</form>
|
||||||
<div class="job" data-job="prospect"></div>
|
<div class="job" data-job="prospect"></div>
|
||||||
|
|
@ -190,6 +191,7 @@ function projectItem(p, smtp, dbCfg, imap) {
|
||||||
<option value="normal" selected>Normal (Sonnet)</option>
|
<option value="normal" selected>Normal (Sonnet)</option>
|
||||||
<option value="approfondi">Approfondi (Opus, coûteux)</option>
|
<option value="approfondi">Approfondi (Opus, coûteux)</option>
|
||||||
</select></label>
|
</select></label>
|
||||||
|
<label>Quand<select name="when"><option value="now">Maintenant</option><option value="night">Cette nuit (1h-6h)</option></select></label>
|
||||||
<button class="btn primary">Chercher et envoyer par mail</button>
|
<button class="btn primary">Chercher et envoyer par mail</button>
|
||||||
</form>
|
</form>
|
||||||
<div class="job" data-job="evolution"></div>
|
<div class="job" data-job="evolution"></div>
|
||||||
|
|
|
||||||
|
|
@ -161,3 +161,16 @@ test('SECRET_KEY changée : le panel reste utilisable, les secrets sont à ressa
|
||||||
assert.equal(r.status, 200, 'on peut ressaisir');
|
assert.equal(r.status, 200, 'on peut ressaisir');
|
||||||
} finally { console.warn = warn; }
|
} finally { console.warn = warn; }
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('« Cette nuit » programme le job au prochain créneau 1h-6h', async () => {
|
||||||
|
const id = app.db.prepare('SELECT id FROM projects LIMIT 1').get().id;
|
||||||
|
app.db.prepare("UPDATE jobs SET status = 'cancelled' WHERE status IN ('queued', 'running')").run();
|
||||||
|
const r = await post(`/api/projects/${id}/evolution`, { count: 3, level: 'rapide', when: 'night' });
|
||||||
|
assert.equal(r.status, 200);
|
||||||
|
const job = app.db.prepare("SELECT run_after FROM jobs WHERE type = 'evolution' ORDER BY id DESC LIMIT 1").get();
|
||||||
|
const { parisParts } = await import('../src/services/paris-time.js');
|
||||||
|
const p = parisParts(new Date(job.run_after * 1000));
|
||||||
|
assert.ok(p.hour >= 1 && p.hour < 6, `démarrage à ${p.hour}h`);
|
||||||
|
const sys = await (await get('/api/system')).json();
|
||||||
|
assert.ok(job.run_after > now() ? sys.scheduled >= 1 : true);
|
||||||
|
});
|
||||||
|
|
|
||||||
43
test/night.test.js
Normal file
43
test/night.test.js
Normal file
|
|
@ -0,0 +1,43 @@
|
||||||
|
import { test } from 'node:test';
|
||||||
|
import assert from 'node:assert/strict';
|
||||||
|
import { parisParts, parisTime, nextNightSlot, addParisDays } from '../src/services/paris-time.js';
|
||||||
|
import { openDb, now } from '../src/db.js';
|
||||||
|
import { enqueue, Worker, latestJobs } from '../src/services/jobs.js';
|
||||||
|
|
||||||
|
const iso = (d) => d.toISOString();
|
||||||
|
|
||||||
|
test('parisParts / parisTime : aller-retour, été comme hiver', () => {
|
||||||
|
assert.deepEqual(parisParts(new Date('2026-10-21T13:34:00Z')), { year: 2026, month: 10, day: 21, hour: 15, minute: 34, weekday: 'Wed' });
|
||||||
|
assert.equal(iso(parisTime(2026, 7, 14, 9)), '2026-07-14T07:00:00.000Z', 'été : UTC+2');
|
||||||
|
assert.equal(iso(parisTime(2026, 12, 25, 9)), '2026-12-25T08:00:00.000Z', 'hiver : UTC+1');
|
||||||
|
assert.deepEqual(addParisDays(new Date('2026-12-31T22:00:00Z'), 1), { year: 2027, month: 1, day: 1 }, 'passage d\'année');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('prochain créneau de nuit (1h-6h Paris)', () => {
|
||||||
|
const at = (s) => iso(nextNightSlot(new Date(s)));
|
||||||
|
assert.equal(at('2026-10-21T15:30:00+02:00'), '2026-10-21T23:00:00.000Z', 'après-midi → 1h le lendemain');
|
||||||
|
assert.equal(at('2026-10-22T00:30:00+02:00'), '2026-10-21T23:00:00.000Z', '0h30 → 1h le même jour');
|
||||||
|
assert.equal(at('2026-10-22T03:00:00+02:00'), '2026-10-22T01:00:00.000Z', 'déjà dans le créneau → tout de suite');
|
||||||
|
assert.equal(at('2026-10-22T06:00:00+02:00'), '2026-10-22T23:00:00.000Z', '6h pile → nuit suivante');
|
||||||
|
assert.equal(at('2026-10-24T22:00:00+02:00'), '2026-10-24T23:00:00.000Z', 'nuit du passage à l\'heure d\'hiver');
|
||||||
|
assert.equal(at('2027-03-27T20:00:00+01:00'), '2027-03-28T00:00:00.000Z', 'nuit du passage à l\'heure d\'été');
|
||||||
|
assert.equal(at('2026-12-31T23:59:00+01:00'), '2027-01-01T00:00:00.000Z', 'Saint-Sylvestre');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('le worker ne démarre pas un job programmé avant son heure', async () => {
|
||||||
|
const db = openDb(':memory:');
|
||||||
|
let clock = now();
|
||||||
|
const ran = [];
|
||||||
|
const w = new Worker(db, { prospect: async () => { ran.push('prospect'); }, evolution: async () => { ran.push('evolution'); } },
|
||||||
|
{ thermalMax: 999, log: { error() {} }, clock: () => clock });
|
||||||
|
db.prepare("INSERT INTO projects(name, git_url, created_at) VALUES('p', 'u', ?)").run(now());
|
||||||
|
enqueue(db, { projectId: 1, type: 'prospect', runAfter: clock + 3600 });
|
||||||
|
enqueue(db, { projectId: 1, type: 'evolution' });
|
||||||
|
assert.equal(await w.tick(), true);
|
||||||
|
assert.deepEqual(ran, ['evolution'], 'le job immédiat passe devant le job programmé');
|
||||||
|
assert.equal(await w.tick(), false, 'rien à faire avant l\'heure');
|
||||||
|
assert.equal(latestJobs(db, 1).prospect.runAfter, clock + 3600);
|
||||||
|
clock += 3601;
|
||||||
|
assert.equal(await w.tick(), true);
|
||||||
|
assert.deepEqual(ran, ['evolution', 'prospect']);
|
||||||
|
});
|
||||||
Loading…
Reference in a new issue