gabriel / musehub public
perf BREAKING feat/async-r2-upload-and-cf-worker #1 / 1
AI Agent gabriel · 70 days ago · Apr 12, 2026 · Diff

perf: async R2 upload + Cloudflare Worker for native R2 binding

- wire_push_object_pack now returns 200 immediately after a single DB write (storage_uri='pending', content_cache=raw_bytes). R2 upload happens in a background asyncio task, eliminating EC2→R2 network latency from the client's critical path entirely (~875ms → ~5ms).

- Fetch path handles pending objects: _pack_objects_response serves content_cache when storage_uri=='pending', so pulls never block on the background upload task.

- Startup recovery in lifespan re-queues any objects left pending from a prior crash — content_cache bytes survive in Postgres.

- Alembic migration 0042 adds content_cache BYTEA (nullable) to musehub_objects.

- cloudflare/pack-receiver/worker.js: Cloudflare Worker that receives MWP packs, stores objects directly to R2 via native R2 binding (~1ms/PUT, no EC2 hop), then calls /internal/register-objects to register IDs in Postgres.

- /internal/register-objects route + WORKER_INTERNAL_KEY setting for the Worker→MuseHub callback leg.

107/107 wire protocol tests pass.

sha256:38d96d4059b3ebc86e30f7fe0d6df03d245d82ebc3675453e5dbb6a481972b4a sha
sha256:ddd698388937667bd382a398a0372f42f89e9569535fe8b3ca742b8e65ec925e snapshot
← Older Oldest on feat/async-r2-upload-and-cf-worker
All commits
Newer → Latest on feat/async-r2-upload-and-cf-worker

0 comments

No comments yet. Be the first to start the discussion.

To add a comment, use the Muse CLI: muse hub commit comment sha256:38d96d4059b3ebc86e30f7fe0d6df03d245d82ebc3675453e5dbb6a481972b4a --body "your comment"