Skip to content

perf(monitor): dedupe initial ws subscriptions#120

Merged
cgfixit merged 1 commit into
mainfrom
codex/polymarket-optimize-ws-subscription
Jul 13, 2026
Merged

perf(monitor): dedupe initial ws subscriptions#120
cgfixit merged 1 commit into
mainfrom
codex/polymarket-optimize-ws-subscription

Conversation

@cgfixit

@cgfixit cgfixit commented Jul 13, 2026

Copy link
Copy Markdown
Owner

What

  • Route the initial WebSocket subscription through the existing snapshot-diff helper.
  • Reset the snapshot on each new socket so reconnects still synchronize desired tokens.
  • Add a deterministic fake-socket regression test.

Why

The direct initial send did not update _last_subscribed, so the heartbeat or first inbound message sent the same subscription again.

Impact

The monitor sends one initial market-subscription frame per socket without changing the desired token set, order flow, risk rules, or live-mode gating.

Validation

  • pytest -m "not integration" — 624 passed
  • pytest tests/test_monitor.py -q — 55 passed
  • ruff check . — passed
  • ruff format --check . — passed
  • mypy polymarket_copier --ignore-missing-imports --no-strict-optional — passed

Risk to monitor

No live WebSocket endpoint was contacted; behavior is covered by the deterministic socket regression test.

@cgfixit
cgfixit marked this pull request as ready for review July 13, 2026 18:30
@cgfixit
cgfixit merged commit 76a15de into main Jul 13, 2026
7 checks passed
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