Skip to content

Paginate analytics reads; enable SurrealDB HTTP - #15

Merged
rivertam merged 1 commit into
mainfrom
fix/analytics-paginated-snapshot
Aug 10, 2026
Merged

Paginate analytics reads; enable SurrealDB HTTP#15
rivertam merged 1 commit into
mainfrom
fix/analytics-paginated-snapshot

Conversation

@rivertam

Copy link
Copy Markdown
Owner

Summary

  • Chunk analytics snapshots; remove dirty DEFINE EVENT #14 deployed but /analytics still standby: even one busy UTC day of analytics_events resets the shared SurrealDB websocket.
  • Page each day in 200-row (occurred_at, id) slices with a wider timeout budget.
  • Enable protocol-http alongside protocol-ws so Railway can use http://surrealdb.railway.internal:8000 (preferred for large reads).

After merge

  1. Confirm deploy is healthy.
  2. Set web SURREALDB_ENDPOINT=http://surrealdb.railway.internal:8000 (docs updated).
  3. Leave ANALYTICS_FACTS_BACKFILL unset.

Test plan

  • just check
  • /analytics?range=7d shows metrics
  • Logs stop showing Connection reset on analytics snapshot
  • /spire and /lifting still load

Made with Cursor

Day-sized chunks still reset the shared websocket on busy windows. Page each
day in 200-row slices, compile in protocol-http so production can use an
http:// endpoint for large reads, and document the preferred endpoint.

Co-authored-by: Cursor <cursoragent@cursor.com>
@rivertam
rivertam merged commit 87a57d1 into main Aug 10, 2026
1 check passed
@rivertam
rivertam deleted the fix/analytics-paginated-snapshot branch August 10, 2026 04:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant