@obzerver/server 0.15.0 → 0.16.0

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.
@@ -0,0 +1,32 @@
1
+ import * as queries from './queries.js';
2
+ import * as simple from './simple.js';
3
+ import * as history from './history.js';
4
+ import { retention } from './db.js';
5
+ import { pruneSpanTrees } from './usage.js';
6
+ export interface Job {
7
+ id: number;
8
+ file: string;
9
+ module: keyof typeof MODULES;
10
+ fn: string;
11
+ args: unknown[];
12
+ }
13
+ export type Reply = {
14
+ id: number;
15
+ ok: true;
16
+ value: unknown;
17
+ } | {
18
+ id: number;
19
+ ok: false;
20
+ error: string;
21
+ stack?: string;
22
+ };
23
+ declare const MODULES: {
24
+ readonly queries: typeof queries;
25
+ readonly simple: typeof simple;
26
+ readonly history: typeof history;
27
+ readonly maintenance: {
28
+ readonly retention: typeof retention;
29
+ readonly pruneSpanTrees: typeof pruneSpanTrees;
30
+ };
31
+ };
32
+ export {};
@@ -0,0 +1,35 @@
1
+ // The background worker's side: its own connections to the project databases, and the read queries and
2
+ // roll-ups it runs on them, so they never hold up ingest on the server's event loop.
3
+ import { parentPort } from 'node:worker_threads';
4
+ import * as queries from './queries.js';
5
+ import * as simple from './simple.js';
6
+ import * as history from './history.js';
7
+ import { Db, retention } from './db.js';
8
+ import { pruneSpanTrees } from './usage.js';
9
+ const MODULES = { queries, simple, history, maintenance: { retention, pruneSpanTrees } };
10
+ const open = new Map();
11
+ const dbFor = (file) => {
12
+ let d = open.get(file);
13
+ if (!d)
14
+ open.set(file, (d = Db.attach(file)));
15
+ return d;
16
+ };
17
+ parentPort?.on('message', (job) => {
18
+ if ('close' in job) {
19
+ open.get(job.close)?.close();
20
+ open.delete(job.close);
21
+ return;
22
+ }
23
+ let reply;
24
+ try {
25
+ const fn = MODULES[job.module][job.fn];
26
+ if (typeof fn !== 'function')
27
+ throw new Error(`No ${job.module}.${job.fn}`);
28
+ reply = { id: job.id, ok: true, value: fn(dbFor(job.file), ...job.args) };
29
+ }
30
+ catch (e) {
31
+ reply = { id: job.id, ok: false, error: e.message, stack: e.stack };
32
+ }
33
+ parentPort.postMessage(reply);
34
+ });
35
+ //# sourceMappingURL=readworker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"readworker.js","sourceRoot":"","sources":["../src/readworker.ts"],"names":[],"mappings":"AAAA,uGAAuG;AACvG,qFAAqF;AACrF,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,KAAK,OAAO,MAAM,cAAc,CAAC;AACxC,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AACtC,OAAO,KAAK,OAAO,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAK5C,MAAM,OAAO,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,EAAE,SAAS,EAAE,cAAc,EAAE,EAAW,CAAC;AAClG,MAAM,IAAI,GAAG,IAAI,GAAG,EAAc,CAAC;AACnC,MAAM,KAAK,GAAG,CAAC,IAAY,EAAM,EAAE;IACjC,IAAI,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACvB,IAAI,CAAC,CAAC;QAAE,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC9C,OAAO,CAAC,CAAC;AACX,CAAC,CAAC;AAEF,UAAU,EAAE,EAAE,CAAC,SAAS,EAAE,CAAC,GAA4B,EAAE,EAAE;IACzD,IAAI,OAAO,IAAI,GAAG,EAAE,CAAC;QAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,CAAC;QAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QAAC,OAAO;IAAC,CAAC;IACrF,IAAI,KAAY,CAAC;IACjB,IAAI,CAAC;QACH,MAAM,EAAE,GAAI,OAAO,CAAC,GAAG,CAAC,MAAM,CAA6B,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACpE,IAAI,OAAO,EAAE,KAAK,UAAU;YAAE,MAAM,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,MAAM,IAAI,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC;QAC5E,KAAK,GAAG,EAAE,EAAE,EAAE,GAAG,CAAC,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAG,EAA2C,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,GAAG,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;IACtH,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,KAAK,GAAG,EAAE,EAAE,EAAE,GAAG,CAAC,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAG,CAAW,CAAC,OAAO,EAAE,KAAK,EAAG,CAAW,CAAC,KAAK,EAAE,CAAC;IAC5F,CAAC;IACD,UAAW,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;AACjC,CAAC,CAAC,CAAC"}
package/dist/server.d.ts CHANGED
@@ -26,6 +26,8 @@ export interface ServerOptions {
26
26
  ingestQueue?: number | string;
27
27
  /** Event-loop delay (ms) past which new batches get "busy, retry later". OBZERVER_SHED_LAG_MS, default 500. */
28
28
  shedLagMs?: number | string;
29
+ /** Threads that run dashboard reads and roll-ups off the event loop; 0 runs them inline. OBZERVER_READ_THREADS, default 1. */
30
+ readThreads?: number | string;
29
31
  /** Which proxies may set X-Forwarded-For: true, false, or addresses/CIDRs. OBZERVER_TRUST_PROXY, default private networks. */
30
32
  trustProxy?: boolean | string;
31
33
  retentionDays?: number | string;
@@ -64,6 +66,7 @@ export interface ServerConfig {
64
66
  ingestRate: number;
65
67
  ingestQueue: number;
66
68
  shedLagMs: number;
69
+ readThreads: number;
67
70
  trustProxy: boolean | string;
68
71
  }
69
72
  export interface ObzerverServer {
package/dist/server.js CHANGED
@@ -7,7 +7,7 @@ import fs from 'node:fs';
7
7
  import path from 'node:path';
8
8
  import { fileURLToPath } from 'node:url';
9
9
  import { openSecretCount, secretFindings, secretGroups } from './secrets.js';
10
- import { baseline, history, historyInfo, historyTick, typical } from './history.js';
10
+ import { baseline, history, historyInfo, typical } from './history.js';
11
11
  import { getSetting, setSetting, retention, hashSecret, newMcpToken } from './db.js';
12
12
  import { createKey, listKeys, revokeKey, rotateKey, KeyError } from './keys.js';
13
13
  import { RateLimiter } from './ratelimit.js';
@@ -19,12 +19,16 @@ import { mcpHandler, MCP_TOOL_NAMES } from './mcp.js';
19
19
  import { issueRow, verifyFix, runVerification, MEASURABLE } from './issues.js';
20
20
  import { PROVIDERS, PROVIDER_LABEL, TrackerError, createTicket, syncTickets, onIssueResolved, onVerification, publicTrackerSettings, saveTrackerSettings, testTracker, trackerSettings, verifyGithubSignature, verifyLinearSignature, handleGithubEvent, handleLinearEvent, } from './trackers.js';
21
21
  import * as Q from './queries.js';
22
- import { simpleHome, simpleAlerts, saveSimpleAlerts, simpleTestRule, simpleReleases } from './simple.js';
22
+ import { simpleAlerts, saveSimpleAlerts, simpleTestRule } from './simple.js';
23
23
  import { listSlos, sloStatus, sloHistory, saveSlo, deleteSlo, validateSlo, toSlo, burnRulesFor } from './slos.js';
24
24
  import { slugify as slugifyPage, toPage, toIncident, validatePage, savePage, deletePage, createIncident, updateIncident, pageView, publicView, renderStatusHtml, runAutoIncidents } from './status.js';
25
25
  import { mailConfig, maskSmtpUrl, parseRecipients, sendMail, resetMailTransports, alertEmail } from './mailer.js';
26
26
  import { AiMeter } from './aiusage.js';
27
27
  import { IngestQueue } from './ingestqueue.js';
28
+ import { Reader } from './reader.js';
29
+ import { walStats } from './checkpoint.js';
30
+ import * as S from './simple.js';
31
+ import * as H from './history.js';
28
32
  import { UsageMeter, pruneSpanTrees, SPAN_TREE_DAYS } from './usage.js';
29
33
  const here = path.dirname(fileURLToPath(import.meta.url));
30
34
  const isLoopback = (host) => ['127.0.0.1', '::1', 'localhost'].includes(host) || host.startsWith('127.');
@@ -58,6 +62,7 @@ export async function createServer(opts = {}) {
58
62
  ingestRate: (() => { const v = Number(opts.ingestRate ?? env.OBZERVER_INGEST_RATE ?? 20); return Number.isFinite(v) && v >= 0 ? v : 20; })(),
59
63
  ingestQueue: (() => { const v = Number(opts.ingestQueue ?? env.OBZERVER_INGEST_QUEUE ?? 100); return Number.isFinite(v) && v >= 1 ? v : 100; })(),
60
64
  shedLagMs: (() => { const v = Number(opts.shedLagMs ?? env.OBZERVER_SHED_LAG_MS ?? 500); return Number.isFinite(v) && v >= 50 ? v : 500; })(),
65
+ readThreads: (() => { const v = Number(opts.readThreads ?? env.OBZERVER_READ_THREADS ?? 1); return Number.isInteger(v) && v >= 0 && v <= 16 ? v : 1; })(),
61
66
  trustProxy: (() => {
62
67
  const v = opts.trustProxy ?? env.OBZERVER_TRUST_PROXY;
63
68
  if (v === undefined)
@@ -129,12 +134,18 @@ export async function createServer(opts = {}) {
129
134
  const ingestQueue = new IngestQueue({
130
135
  runInTx: (slug, fn) => projects.run(slug, () => projects.db(slug).tx(fn)),
131
136
  maxQueued: config.ingestQueue, maxLagMs: config.shedLagMs,
137
+ isPaused: (slug) => projects.db(slug).paused,
132
138
  });
133
139
  const toolOpts = { usage: () => ({ ...usage.report(), askObzeri: aiMeter.report() }), locked: lockedText };
134
140
  const mcp = mcpHandler(db, toolOpts);
135
141
  const secret = getSetting(root, 'session_secret') ?? crypto.randomBytes(32).toString('hex');
136
142
  const app = Fastify({ logger: config.logger, bodyLimit: 25 * 1024 * 1024, trustProxy: config.trustProxy });
137
143
  app.addHook('onClose', async () => { ingestQueue.close(); });
144
+ // Dashboard reads and roll-ups: in the read worker for databases on disk (the current project's).
145
+ const reader = new Reader(config.readThreads);
146
+ app.addHook('onClose', async () => { await reader.close(); });
147
+ const MODULES = { queries: Q, simple: S, history: H, maintenance: { retention, pruneSpanTrees } };
148
+ const read = (module, fn, ...args) => reader.run(db.path, db, module, fn, args, () => MODULES[module][fn](db, ...args));
138
149
  // ---------------------------------------------------------------- auth
139
150
  // The dashboard password is kept only as a hash. Sessions are signed with it too, so changing the password
140
151
  // signs everyone out.
@@ -225,7 +236,7 @@ export async function createServer(opts = {}) {
225
236
  app.get('/healthz', async (_req, reply) => {
226
237
  try {
227
238
  db.get('SELECT 1');
228
- return { ok: true, version: VERSION, uptime: Math.round((Date.now() - started) / 1000), ingest: { queued: ingestQueue.queued, lagMs: Math.round(ingestQueue.lagMs), shed: ingestQueue.shed } };
239
+ return { ok: true, version: VERSION, uptime: Math.round((Date.now() - started) / 1000), ingest: { queued: ingestQueue.queued, lagMs: Math.round(ingestQueue.lagMs), shed: ingestQueue.shed }, reads: reader.stats(), wal: walStats };
229
240
  }
230
241
  catch (e) {
231
242
  return reply.code(503).send({ ok: false, version: VERSION, error: e.message });
@@ -281,6 +292,9 @@ export async function createServer(opts = {}) {
281
292
  });
282
293
  app.delete('/api/projects/:slug', async (req, reply) => {
283
294
  try {
295
+ const file = projects.has(req.params.slug) ? projects.db(req.params.slug).path : null;
296
+ if (file)
297
+ reader.forget(file);
284
298
  projects.remove(req.params.slug);
285
299
  ingests.delete(req.params.slug);
286
300
  usage.invalidate();
@@ -407,8 +421,8 @@ export async function createServer(opts = {}) {
407
421
  });
408
422
  app.post('/api/usage/resume', async () => { usage.resume(); return usage.report(); });
409
423
  // Simple mode: health, what broke, what changed and what to do, in plain words.
410
- app.get('/api/simple', async (req) => simpleHome(db, w(req.query)));
411
- app.get('/api/simple/releases', async (req) => simpleReleases(db, w(req.query)));
424
+ app.get('/api/simple', async (req) => await read('simple', 'simpleHome', w(req.query)));
425
+ app.get('/api/simple/releases', async (req) => await read('simple', 'simpleReleases', w(req.query)));
412
426
  app.get('/api/simple/alerts', async () => simpleAlerts(db, { emailReady: !!mailConfig(root).url }));
413
427
  app.put('/api/simple/alerts', async (req) => {
414
428
  saveSimpleAlerts(db, req.body || {});
@@ -434,14 +448,14 @@ export async function createServer(opts = {}) {
434
448
  const r = db.run('UPDATE secret_groups SET status = ?, resolved_at = ? WHERE fingerprint = ?', status, status === 'open' ? null : Date.now(), req.params.fp);
435
449
  return r.changes ? { ok: true } : reply.code(404).send({ error: 'not found' });
436
450
  });
437
- app.get('/api/overview', async (req) => Q.overview(db, w(req.query)));
438
- app.get('/api/operations', async (req) => Q.operationsBy(db, w(req.query), req.query.kind || 'http', req.query.protocol));
439
- app.get('/api/operations/series', async (req) => Q.protocolSeries(db, w(req.query), req.query.protocol || 'http'));
451
+ app.get('/api/overview', async (req) => await read('queries', 'overview', w(req.query)));
452
+ app.get('/api/operations', async (req) => await read('queries', 'operationsBy', w(req.query), req.query.kind || 'http', req.query.protocol));
453
+ app.get('/api/operations/series', async (req) => await read('queries', 'protocolSeries', w(req.query), req.query.protocol || 'http'));
440
454
  app.get('/api/operation', async (req, reply) => {
441
455
  const { name, kind, service, sort, filter, limit, offset } = req.query;
442
456
  if (!name)
443
457
  return reply.code(400).send({ error: 'name required' });
444
- return Q.operation(db, w(req.query), { name, kind: kind || 'http', service, sort, filter, limit, offset });
458
+ return read('queries', 'operation', w(req.query), { name, kind: kind || 'http', service, sort, filter, limit, offset });
445
459
  });
446
460
  app.get('/api/history', async (req) => {
447
461
  const { kind, service, name, days } = req.query;
@@ -453,34 +467,34 @@ export async function createServer(opts = {}) {
453
467
  const t = Number(at) || Date.now();
454
468
  return { thisHour: baseline(db, f, t), last4Weeks: typical(db, f, t) };
455
469
  });
456
- app.get('/api/executions/:id', async (req, reply) => Q.execution(db, req.params.id) ?? notFound(reply));
470
+ app.get('/api/executions/:id', async (req, reply) => await read('queries', 'execution', req.params.id) ?? notFound(reply));
457
471
  app.get('/api/executions/:id/prompt', async (req, reply) => {
458
472
  const prompt = Q.agentPrompt(db, req.params.id);
459
473
  return prompt ? { prompt } : notFound(reply);
460
474
  });
461
- app.get('/api/traces', async (req) => Q.traces(db, w(req.query), { q: req.query.q, failed: req.query.failed, minDuration: req.query.minDuration, kind: req.query.kind, limit: req.query.limit }));
462
- app.get('/api/traces/:traceId', async (req, reply) => Q.traceById(db, req.params.traceId) ?? notFound(reply));
463
- app.get('/api/errors', async (req) => Q.errorGroups(db, w(req.query), { handled: req.query.handled ?? '0', status: req.query.status }));
464
- app.get('/api/errors/:fp', async (req, reply) => Q.errorGroup(db, w(req.query), req.params.fp) ?? notFound(reply));
475
+ app.get('/api/traces', async (req) => await read('queries', 'traces', w(req.query), { q: req.query.q, failed: req.query.failed, minDuration: req.query.minDuration, kind: req.query.kind, limit: req.query.limit }));
476
+ app.get('/api/traces/:traceId', async (req, reply) => await read('queries', 'traceById', req.params.traceId) ?? notFound(reply));
477
+ app.get('/api/errors', async (req) => await read('queries', 'errorGroups', w(req.query), { handled: req.query.handled ?? '0', status: req.query.status }));
478
+ app.get('/api/errors/:fp', async (req, reply) => await read('queries', 'errorGroup', w(req.query), req.params.fp) ?? notFound(reply));
465
479
  app.patch('/api/errors/:fp', async (req) => {
466
480
  const status = ['open', 'resolved', 'ignored'].includes(req.body?.status ?? '') ? req.body.status : 'open';
467
481
  db.run('UPDATE error_groups SET status = ?, resolved_at = ? WHERE fingerprint = ?', status, status === 'resolved' ? Date.now() : null, req.params.fp);
468
482
  return { ok: true };
469
483
  });
470
- app.get('/api/logs', async (req) => Q.logs(db, w(req.query), { level: req.query.level, q: req.query.q, traceId: req.query.traceId, before: req.query.before, limit: req.query.limit }));
471
- app.get('/api/functions', async (req) => Q.functions(db, w(req.query)));
472
- app.get('/api/queries', async (req) => Q.queries(db, w(req.query)));
473
- app.get('/api/outbound', async (req) => Q.outbound(db, w(req.query)));
474
- app.get('/api/users', async (req) => Q.users(db, w(req.query), { groupBy: req.query.groupBy }));
475
- app.get('/api/users/:id', async (req) => Q.user(db, w(req.query), req.params.id));
476
- app.get('/api/runtime', async (req) => Q.runtime(db, w(req.query)));
477
- app.get('/api/runtime/view', async (req, reply) => req.query.service ? Q.runtimeView(db, w(req.query), { service: req.query.service, instance: req.query.instance || null }) : reply.code(400).send({ error: 'service required' }));
478
- app.get('/api/runtime/spike', async (req) => Q.runtimeSpike(db, { service: req.query.service || '', instance: req.query.instance, ts: Number(req.query.ts), windowMs: Number(req.query.windowMs) || 60000 }));
479
- app.get('/api/metrics', async (req) => Q.metricsList(db, w(req.query)));
480
- app.get('/api/metrics/:name', async (req) => Q.metricSeries(db, w(req.query), req.params.name));
481
- app.get('/api/releases', async (req) => Q.releases(db, w(req.query)));
482
- app.get('/api/releases/:service/:version', async (req, reply) => Q.releaseVerdict(db, req.params.service, req.params.version) ?? notFound(reply));
483
- app.get('/api/map', async (req) => Q.serviceMap(db, w(req.query)));
484
+ app.get('/api/logs', async (req) => await read('queries', 'logs', w(req.query), { level: req.query.level, q: req.query.q, traceId: req.query.traceId, before: req.query.before, limit: req.query.limit }));
485
+ app.get('/api/functions', async (req) => await read('queries', 'functions', w(req.query)));
486
+ app.get('/api/queries', async (req) => await read('queries', 'queries', w(req.query)));
487
+ app.get('/api/outbound', async (req) => await read('queries', 'outbound', w(req.query)));
488
+ app.get('/api/users', async (req) => await read('queries', 'users', w(req.query), { groupBy: req.query.groupBy }));
489
+ app.get('/api/users/:id', async (req) => await read('queries', 'user', w(req.query), req.params.id));
490
+ app.get('/api/runtime', async (req) => await read('queries', 'runtime', w(req.query)));
491
+ app.get('/api/runtime/view', async (req, reply) => req.query.service ? await read('queries', 'runtimeView', w(req.query), { service: req.query.service, instance: req.query.instance || null }) : reply.code(400).send({ error: 'service required' }));
492
+ app.get('/api/runtime/spike', async (req) => await read('queries', 'runtimeSpike', { service: req.query.service || '', instance: req.query.instance, ts: Number(req.query.ts), windowMs: Number(req.query.windowMs) || 60000 }));
493
+ app.get('/api/metrics', async (req) => await read('queries', 'metricsList', w(req.query)));
494
+ app.get('/api/metrics/:name', async (req) => await read('queries', 'metricSeries', w(req.query), req.params.name));
495
+ app.get('/api/releases', async (req) => await read('queries', 'releases', w(req.query)));
496
+ app.get('/api/releases/:service/:version', async (req, reply) => await read('queries', 'releaseVerdict', req.params.service, req.params.version) ?? notFound(reply));
497
+ app.get('/api/map', async (req) => await read('queries', 'serviceMap', w(req.query)));
484
498
  // ---------------------------------------------------------------- alerts
485
499
  const ruleRow = (r) => ({ ...r, ...toRule(r) });
486
500
  app.get('/api/alerts', async () => ({ types: RULE_TYPES, rules: db.all('SELECT * FROM alert_rules ORDER BY id').map(ruleRow) }));
@@ -942,12 +956,12 @@ export async function createServer(opts = {}) {
942
956
  app.addHook('onClose', async () => { for (const t of timers)
943
957
  clearInterval(t); projects.close(); });
944
958
  /** Retention for the current project: the plan's window, and on plans past 7 days, span trees of fast successes go at 7. */
945
- const runRetention = () => {
946
- historyTick(db, historyCfg());
959
+ const runRetention = async () => {
960
+ await read('history', 'historyTick', historyCfg());
947
961
  const days = usage.retentionDays(config.retentionDays);
948
- retention(db, days);
962
+ await read('maintenance', 'retention', days);
949
963
  if (days > SPAN_TREE_DAYS && usage.plan().retentionDays != null)
950
- pruneSpanTrees(db);
964
+ await read('maintenance', 'pruneSpanTrees');
951
965
  };
952
966
  // Background passes run once per project, each against its own database.
953
967
  const perProject = (label, fn) => () => projects.each(fn, (slug, e) => log(`${label} [${slug}]: ${e.message}`));
@@ -960,10 +974,10 @@ export async function createServer(opts = {}) {
960
974
  every(config.ticketSyncMs, perProject('tickets', () => syncTickets(db, log)), 'tickets');
961
975
  every(60000, perProject('status', () => runAutoIncidents(db, Date.now(), log)), 'status');
962
976
  // Roll-ups first, so raw data is summarised before retention removes it.
963
- every(5 * 60000, perProject('history', () => historyTick(db, historyCfg())), 'history');
977
+ every(5 * 60000, perProject('history', () => read('history', 'historyTick', historyCfg())), 'history');
964
978
  every(3600e3, perProject('retention', () => runRetention()), 'retention');
965
979
  // On first start after an upgrade, roll up the raw days already stored in one go.
966
- const first = setTimeout(perProject('history', () => historyTick(db, historyCfg(), Date.now(), Math.ceil(config.retentionDays * 24) + 2)), 1500);
980
+ const first = setTimeout(perProject('history', () => read('history', 'historyTick', historyCfg(), Date.now(), Math.ceil(config.retentionDays * 24) + 2)), 1500);
967
981
  first.unref();
968
982
  timers.push(first);
969
983
  return app;