Skip to content

Commit 9ead592

Browse files
committed
feat(rfq): debounce and rate-limit levels republish after quote expiry
- Add `LEVELS_REPUBLISH_COALESCE` (25ms) debounce to batch `quoteExpired` frames into a single levels flush, preventing reconnect replay from emitting one book per expiry and collapsing the cadence to ~2s - Implement rate window tracking to respect venue's 40/s `admitMessage` cap across levels frames, quote replies, and expiry flushes in a 1s rolling window - Track `pending_republish` set of corridors with dropped quotes; arm trailing flush only when known corridors expire, not on every frame - Skip trailing flush when dark feeds exist (no ready frames) to avoid wasting budget, but keep debounce armed to retry when feed recovers - Defer trailing flush if 40/s budget is exhausted; schedule retry when oldest batches age out of the 1s window - Skip interval tick when trailing flush is pending or recently fired (within last 1s) to prevent doubling book depth in the same second; reschedule tick to end of expiry window to avoid phase drift - Drop emitted corridors from `pending_republish` after successful send to prevent resending on next expiry and growing the set unboundedly - Use `biased` select to prioritize inbound over interval tick so `quoteExpired` beats the timer until trailing debounce fires, fixing starvation where books dropped after the venue's 1s republish wait completed - Add `Reservations::corridor()` peek method to identify which corridor a quote belongs to, enabling targeted expiry flushes instead of full republish - Add comprehensive tests covering rate window mechanics, debounce timers, dark feed detection, and interval suppression logic
1 parent 0f8decf commit 9ead592

6 files changed

Lines changed: 572 additions & 24 deletions

File tree

.textile-monorepo-source

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
13abce09db04af686db9d4002b51322d3e8a4ae4
1+
c4c41ccd27cc21b3504d72856652ca5cf19a6e90

.textile-stitch-release-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.1.205
1+
0.1.206

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "stitch-bot"
3-
version = "0.1.205"
3+
version = "0.1.206"
44
edition = "2021"
55
description = "Stitch — Textile filler-network operator bot; market-makes the filler order book with signed UniswapX limit orders."
66
license = "AGPL-3.0-or-later"

0 commit comments

Comments
 (0)