Add a bisect hook (?limit=) to the internal snapshot trigger

The cap raise 25 -> 500 made an induced snapshot 502 at 13.4s and the run
did not complete in background either, while a 25-prop run had completed
in 16.3s. That rules out a simple duration timeout and means the cause has
to be measured, not guessed. ?limit= bounds one run so the regression can
be bisected without a prod env change; omitted, the real DEFAULT_LIMIT
applies.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QJs13VsyiSKYQP6rj3NNmc
This commit is contained in:
Kev
2026-08-01 02:12:07 -04:00
parent a7d6cf8e36
commit 8d052131c5
2 changed files with 11 additions and 2 deletions
+6 -2
View File
@@ -177,8 +177,12 @@ router.get('/snapshot/status', async (req, res) => {
router.post('/snapshot/:sport', async (req, res) => {
const snapshot = require('../services/snapshotService');
try {
const summary = await snapshot.runSnapshot(req.params.sport);
return res.json({ ok: true, summary });
// ?limit= is a BISECT HOOK, not a production knob: it bounds the graded
// slate for one run so a cap regression can be isolated by measurement
// rather than guessed at. Omitted => gradeSlateService's real DEFAULT_LIMIT.
const limit = Number(req.query.limit) > 0 ? Number(req.query.limit) : undefined;
const summary = await snapshot.runSnapshot(req.params.sport, limit ? { limit } : {});
return res.json({ ok: true, ...(limit ? { limit_override: limit } : {}), summary });
} catch (err) {
const message = err && err.message ? err.message : String(err);
console.error('[internal/snapshot] failed:', message);
+5
View File
@@ -400,6 +400,11 @@ async function runSnapshot(sport, opts = {}) {
// letting it write (we re-write an ENRICHED version below).
let envelope = null;
await deps.gradeAndCacheSlate(sp, props, {
// Bisect hook (2026-08-01): lets the internal trigger run a bounded slate
// without a prod env change, so a cap regression can be isolated by
// measurement instead of guessed at. Omitted => gradeSlateService's own
// DEFAULT_LIMIT (the real production value).
...(Number(opts.limit) > 0 ? { limit: Number(opts.limit) } : {}),
source: (odds && odds.provider) || 'odds-api',
now: deps.now,
cacheSet: async (_k, v) => { envelope = v; },