mirror of
https://github.com/gadgethd/ukmesh.git
synced 2026-09-09 08:43:45 +00:00
Backend: - getViableLinks: replace correlated EXISTS subquery (2m 49s!) with CTE-based join on pre-computed node set (39ms) — eliminates WS initial state timeouts - WS initial state: switch from getLastNPackets (1,872ms, 24h correlated subqueries) to getRecentPackets (16ms, 5-min CTE) — cold connect now 30ms - Debounce emitNode/emitNodeUpsert with 500ms window to coalesce rapid advert bursts before publishing to Redis (10-100x fewer publishes during active periods) - Pre-normalise node IDs to lowercase at broadcast time; remove per-client toLowerCase() allocations in shouldSendMessage (~200 allocs/sec eliminated) - Cache /api/path-beta/history (60s TTL) and /api/coverage (30s TTL) - Add 10-min TTL to resolveCache to prevent multi-day unbounded growth - Fix LOWER() on node_status_samples queries suppressing index use - Add Express compression() middleware; add gzip to nginx.website.conf - Increase viableLinksCache TTL 30s→5min, INITIAL_STATE_TTL 30s→60s - Pre-warm initial state cache at startup for teesside+ukmesh - Add compression package dependency Frontend: - Lazy-load coverage (26MB GeoJSON) — only fetch when coverage toggle is on, not on every page mount regardless of filter state - Remove standalone 30s setInterval from useDashboardStats; feed stats from App.tsx consolidated poll instead (-1 HTTP request per 30s) - Pre-compute DeckGL packet-history segment colour+width inside useMemo; getColor/getWidth become pure property lookups (~6000 log() calls/sec removed) - DeckGLOverlay.tsx: add HistorySegmentWithColor type for pre-computed values Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
33 lines
754 B
JSON
33 lines
754 B
JSON
{
|
|
"name": "meshcore-analytics-backend",
|
|
"version": "1.0.0",
|
|
"private": true,
|
|
"type": "module",
|
|
"scripts": {
|
|
"build": "tsc",
|
|
"dev": "tsx watch src/index.ts",
|
|
"start": "node dist/index.js"
|
|
},
|
|
"dependencies": {
|
|
"@michaelhart/meshcore-decoder": "^0.2.7",
|
|
"compression": "^1.7.4",
|
|
"cors": "^2.8.5",
|
|
"express": "^4.19.2",
|
|
"express-rate-limit": "^7.4.1",
|
|
"ioredis": "^5.4.1",
|
|
"mqtt": "^5.10.1",
|
|
"pg": "^8.13.1",
|
|
"ws": "^8.18.0"
|
|
},
|
|
"devDependencies": {
|
|
"@types/compression": "^1.7.5",
|
|
"@types/cors": "^2.8.17",
|
|
"@types/express": "^4.17.21",
|
|
"@types/node": "^20.17.6",
|
|
"@types/pg": "^8.11.10",
|
|
"@types/ws": "^8.5.12",
|
|
"tsx": "^4.19.1",
|
|
"typescript": "^5.6.3"
|
|
}
|
|
}
|