1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
//! Per-tenant scheduled-job budget: a resolve-once cap and the PURE quota gate.
use Status;
/// Per-tenant scheduled-job budget (non-deleted rows). Bounds the durable table
/// so one tenant cannot exhaust the shared store; a new job beyond this fails
/// closed with the typed quota detail. Overridable once via
/// `UDB_MAX_JOBS_PER_TENANT`, resolved through a `OnceLock` — never read per
/// request. Mirrors `search_service`'s `MAX_INDEXES_PER_TENANT` gate.
pub const DEFAULT_MAX_JOBS_PER_TENANT: i64 = 1000;
/// Resolve the per-tenant job budget exactly once (no per-request env reads).
/// A non-positive / unparsable override falls back to the default so the gate
/// is always a real bound.
pub
/// PURE quota gate: refuse when the tenant's non-deleted job count has reached
/// the budget. `ResourceExhausted` + `kind = QUOTA` via the shared
/// `quota_refusal_status` typed detail (same shape as the search-index gate).
pub