gabriel / musehub public
fix patch issue-41-phase5 task/issue-41-phase5-keepalive-heartbeat #1 / 1
AI Agent gabriel · 35 days ago · May 10, 2026 · Diff

fix(issue-41-phase5): TCP keepalive + heartbeat frames in wire_push_stream

database.py: add tcp_keepalives_idle=30 to connect_args so the OS sends TCP keepalive probes every 30s, preventing asyncpg idle-connection reaping during MinIO I/O gaps on the streaming push path.

musehub_wire.py: emit a 'heartbeat' PROGRESS frame after each _flush_batch call when ≥10s have elapsed since the last heartbeat. Keeps the HTTP response stream alive through proxies during slow or large object batches. Module-level _monotonic alias (= time.monotonic) allows tests to patch it.

Tests (test_push_keepalive_heartbeat.py): - P5-1: mocked _monotonic advancing 11s/batch → ≥2 heartbeat P frames - P5-2: source check that init_db configures tcp_keepalives_idle

sha256:59205dc5364e3b8b8ee65784e60732f4779340533db3a9a0ab497996e27f3c23 sha
sha256:b59c729dc2dbbcfa495a87b617bb91475376dd4a0c2cd25edf7af226862c17e3 snapshot
← Older Oldest on task/issue-41-phase5-keepalive-heartbeat
All commits
Newer → Latest on task/issue-41-phase5-keepalive-heartbeat

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:59205dc5364e3b8b8ee65784e60732f4779340533db3a9a0ab497996e27f3c23 --body "your comment"