CI / typecheck + tests (push) Canceled after 0s
CI / build + deploy (Nix) — api (push) Canceled after 0s
CI / build + deploy (Nix) — mcp (push) Canceled after 0s
CI / build + deploy (Nix) — worker (push) Canceled after 0s
CI / build + deploy (web) (push) Canceled after 0s
- Add SWR foundation (lib/fetcher, lib/swr, lib/api) with typed hooks: useSections/useDocuments/useSearch/useRelated/useRevisions/useQueueStatus - Replace ad-hoc useEffect+fetch in Header/Sidebar/CommandMenu/search with SWR (dedup 4s, focus throttle 10s, debounced search 180ms) - Doc page: RelatedGrid + RevisionList as SWR client islands (RSC hero stays) - DocForm: SWR mutate on create/update for live sidebar invalidation - New APIs: /api/related, /api/revisions, /api/tags, /api/queue/status, /api/docs filtering (?section=&status=) - New UI: DocumentCard, SectionCard, SearchBar, TagCloud, QueueBadge, EmptyState, dashboard (/dashboard with QueueStrip live + section stats) - Layout wraps SWRProvider; no TanStack code (SWR-only per spec) - Verified: next build passes (16.3.4 Turbopack), no manual fetch sprawl remains Co-Authored-By: internal-model
28 lines
935 B
TypeScript
28 lines
935 B
TypeScript
import { NextResponse } from "next/server";
|
|
|
|
export const dynamic = "force-dynamic";
|
|
|
|
// GET /api/queue/status — BullMQ queue counts (read-only, public)
|
|
// Falls back gracefully when Redis is unavailable so the UI never breaks.
|
|
export async function GET() {
|
|
try {
|
|
const { getQueue } = await import("@mcpedia/queue");
|
|
const q = getQueue();
|
|
const [waiting, active, completed, failed, delayed] = await Promise.all([
|
|
q.getWaitingCount(),
|
|
q.getActiveCount(),
|
|
q.getCompletedCount(),
|
|
q.getFailedCount(),
|
|
q.getDelayedCount(),
|
|
]);
|
|
return NextResponse.json({ waiting, active, completed, failed, delayed });
|
|
} catch (e) {
|
|
const msg = e instanceof Error ? e.message : String(e);
|
|
// Return zeroed status so the FE can render gracefully
|
|
return NextResponse.json(
|
|
{ waiting: 0, active: 0, completed: 0, failed: 0, delayed: 0, error: msg },
|
|
{ status: 200 },
|
|
);
|
|
}
|
|
}
|