Client Polling & Stale-State Merge

dual-fetch sports loop with odds preservation

Published: 2026-06-26  |  Project: Software as Glass Monorepo  |  Discipline: Distributed Systems & High-Throughput State

Author: Nicholas Alexander MacAskill — Founder & CTO, Flocano Labs  |  Canonical: https://www.nicholasmacaskill.com/dossier/memoirs-client-polling

poll_interval
10s
Verified Invariant
endpoints_per_cycle
2
Verified Invariant
build_guard
force-dynamic
Verified Invariant

Dual-Fetch Client Loop

MusicCodeBanner runs a 10-second interval that hits the fast stats route before the full sports route. On stats success, it rebuilds the sports ticker with fresh volume/profit while keeping existing odds lines until the full payload arrives.

TYPESCRIPTPRODUCTION RUNTIME
const statsRes = await fetch('/memoirs/api/sports/stats', { cache: 'no-store' });
if (statsRes.ok) {
    const stats = await statsRes.json();
    setSportsItems((prev) => {
        const odds = prev.filter((i) => i.id.startsWith('live-') || i.id === 'f1');
        const oddsItems = odds.length > 0 && !odds[0]?.code.includes('LOADING')
            ? odds
            : [{ id: 's1', code: '⚾ UPCOMING MLB GAMES: LOADING...' }];
        return [
            { id: 'stat-vol', code: `💰 STATS | BASEBALL VOLUME: ${stats.volume}` },
            { id: 'stat-profit', code: `📈 STATS | BASEBALL PROFIT: ${stats.profit}` },
            { id: 'stat-win', code: prev.find((i) => i.id === 'stat-win')?.code ?? '🎯 STATS | BASEBALL WIN RATE: LOADING...' },
            ...oddsItems,
        ];
    });
}
const res = await fetch('/memoirs/api/sports', { cache: 'no-store' });

Build & Deploy Guards

Sports routes export dynamic = 'force-dynamic' so Next.js does not pre-render Polymarket fetches at build time (which previously caused Vercel build timeouts). The full route sets maxDuration = 60 to allow cold PnL computation on serverless instances.

SIGNAL_DETECTED:"system online // first dossier lesson logged"//TARGET:sovereign layer////////////////////////
Flocano Labs
ARCHITECTURELAYER
Memoirs
TASTELAYER
Nicholas Alexander MacAskill
IDENTITYLAYER
Biography
ABOUTARCHITECT