@ultimat3/core 27.10.3 → 27.11.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.
- package/package.json +2 -2
- package/src/config-defaults.ts +9 -1
- package/src/config-jobs.ts +20 -0
- package/src/config.ts +14 -0
- package/src/index.ts +7 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ultimat3/core",
|
|
3
|
-
"version": "27.
|
|
3
|
+
"version": "27.11.0",
|
|
4
4
|
"description": "Ultimate's foundation: errors, context, env, config, clock, ids, logging, telemetry, lifecycle",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -37,6 +37,6 @@
|
|
|
37
37
|
"test": "bun test"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@ultimat3/schema": "27.
|
|
40
|
+
"@ultimat3/schema": "27.11.0"
|
|
41
41
|
}
|
|
42
42
|
}
|
package/src/config-defaults.ts
CHANGED
|
@@ -2,7 +2,12 @@
|
|
|
2
2
|
// Split from `config.ts`, which sits at its 500-line ceiling; literals only, so it reads no key.
|
|
3
3
|
|
|
4
4
|
import type { AppConfig } from './config';
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
JOBS_CONCURRENCY_DEFAULT,
|
|
7
|
+
JOBS_DEAD_RETENTION_MS_DEFAULT,
|
|
8
|
+
JOBS_DONE_RETENTION_MS_DEFAULT,
|
|
9
|
+
JOBS_OUTBOX_RETENTION_MS_DEFAULT,
|
|
10
|
+
} from './config-jobs';
|
|
6
11
|
import { DRAIN_DEADLINE_DEFAULT_MS } from './drain-deadline';
|
|
7
12
|
import { defaultReadinessGraceMs } from './lifecycle-grace';
|
|
8
13
|
import { ROLES } from './roles';
|
|
@@ -31,6 +36,9 @@ export function configDefaults(name: string): Omit<AppConfig, Sectioned> {
|
|
|
31
36
|
maxAttempts: 5,
|
|
32
37
|
backoff: 'exponential',
|
|
33
38
|
visibilityTimeoutMs: 30_000,
|
|
39
|
+
doneRetentionMs: JOBS_DONE_RETENTION_MS_DEFAULT,
|
|
40
|
+
deadRetentionMs: JOBS_DEAD_RETENTION_MS_DEFAULT,
|
|
41
|
+
outboxRetentionMs: JOBS_OUTBOX_RETENTION_MS_DEFAULT,
|
|
34
42
|
},
|
|
35
43
|
// ON by default since 22.0.0, when the boot began obeying the key: an app with no section
|
|
36
44
|
// keeps the `sync` node it always got, and `enabled: false` is the explicit opt-out.
|
package/src/config-jobs.ts
CHANGED
|
@@ -14,6 +14,26 @@ import { isJsonObject } from './json-object';
|
|
|
14
14
|
*/
|
|
15
15
|
export const JOBS_CONCURRENCY_DEFAULT = 8;
|
|
16
16
|
|
|
17
|
+
/**
|
|
18
|
+
* `jobs.doneRetentionMs` when no layer says: how long a `done` row and its step records are kept
|
|
19
|
+
* before the boot's hourly purge deletes them. Two weeks — every incident is read inside it, and
|
|
20
|
+
* a finished row is bookkeeping, unlike an inbox message: a `mail.send` input is an address and a
|
|
21
|
+
* rendered body, personal data with no reason to outlive the delivery.
|
|
22
|
+
*/
|
|
23
|
+
export const JOBS_DONE_RETENTION_MS_DEFAULT = 14 * 86_400_000;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* `jobs.deadRetentionMs` when no layer says: `dead`, `failed` and `cancelled` rows, which staff
|
|
27
|
+
* read to explain a failure, kept a quarter.
|
|
28
|
+
*/
|
|
29
|
+
export const JOBS_DEAD_RETENTION_MS_DEFAULT = 90 * 86_400_000;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* `jobs.outboxRetentionMs` when no layer says: a PUBLISHED `x_outbox` row, whose job is already in
|
|
33
|
+
* `x_jobs`, kept a week. An unpublished row is never swept, whatever this says.
|
|
34
|
+
*/
|
|
35
|
+
export const JOBS_OUTBOX_RETENTION_MS_DEFAULT = 7 * 86_400_000;
|
|
36
|
+
|
|
17
37
|
/** One slot count for every queue, or slots per queue name — `jobWorker`'s own `concurrency`. */
|
|
18
38
|
export type JobsConcurrency = number | Readonly<Record<string, number>>;
|
|
19
39
|
|
package/src/config.ts
CHANGED
|
@@ -163,6 +163,17 @@ export interface JobsConfig {
|
|
|
163
163
|
readonly maxAttempts: number;
|
|
164
164
|
readonly backoff: (typeof JOB_BACKOFFS)[number];
|
|
165
165
|
readonly visibilityTimeoutMs: number;
|
|
166
|
+
/**
|
|
167
|
+
* Age past which the hourly purge deletes a `done` row and its steps. Unset: 14 days
|
|
168
|
+
* (`JOBS_DONE_RETENTION_MS_DEFAULT`). OPTIONAL, as `realtime.maxSocketsPerActor` is, so a
|
|
169
|
+
* `JobsConfig` literal written before the key existed still type-checks: `defineConfig` fills it
|
|
170
|
+
* in, and the boot (`runtime-jobs-retention.ts`) resolves the same constant for one that did not.
|
|
171
|
+
*/
|
|
172
|
+
readonly doneRetentionMs?: number | undefined;
|
|
173
|
+
/** The same for `dead`, `failed` and `cancelled` rows. Unset: 90 days. */
|
|
174
|
+
readonly deadRetentionMs?: number | undefined;
|
|
175
|
+
/** Age of `published_at` past which a PUBLISHED `x_outbox` row goes. Unset: 7 days. */
|
|
176
|
+
readonly outboxRetentionMs?: number | undefined;
|
|
166
177
|
}
|
|
167
178
|
|
|
168
179
|
/**
|
|
@@ -274,6 +285,9 @@ function validate(config: AppConfig): void {
|
|
|
274
285
|
...jobsConcurrencyIssues(config.jobs.concurrency),
|
|
275
286
|
countIssue('jobs.maxAttempts', config.jobs.maxAttempts, 1),
|
|
276
287
|
countIssue('jobs.visibilityTimeoutMs', config.jobs.visibilityTimeoutMs, 1),
|
|
288
|
+
...(['doneRetentionMs', 'deadRetentionMs', 'outboxRetentionMs'] as const).map((key) =>
|
|
289
|
+
config.jobs[key] === undefined ? undefined : countIssue(`jobs.${key}`, config.jobs[key], 1),
|
|
290
|
+
),
|
|
277
291
|
oneOfIssue('jobs.backoff', config.jobs.backoff, JOB_BACKOFFS),
|
|
278
292
|
countIssue('cache.defaultTtlMs', config.cache.defaultTtlMs, 0),
|
|
279
293
|
oneOfIssue('database.driver', config.database.driver, DATABASE_DRIVERS),
|
package/src/index.ts
CHANGED
|
@@ -146,7 +146,13 @@ export type { AiConfig, AiConfigInput, McpConfig } from './config-ai';
|
|
|
146
146
|
export type { DrainConfig, HealthConfig, ReadinessMode } from './config-health';
|
|
147
147
|
export { READINESS_MODES } from './config-health';
|
|
148
148
|
export type { IslandsConfig, IslandsSection, IslandsSectionInput } from './config-islands';
|
|
149
|
-
export {
|
|
149
|
+
export {
|
|
150
|
+
JOBS_CONCURRENCY_DEFAULT,
|
|
151
|
+
JOBS_DEAD_RETENTION_MS_DEFAULT,
|
|
152
|
+
JOBS_DONE_RETENTION_MS_DEFAULT,
|
|
153
|
+
JOBS_OUTBOX_RETENTION_MS_DEFAULT,
|
|
154
|
+
type JobsConcurrency,
|
|
155
|
+
} from './config-jobs';
|
|
150
156
|
export type {
|
|
151
157
|
MailConfig,
|
|
152
158
|
MailRetainMimeConfig,
|