feat: quicker orderbook api polling - #5
Merged
Conversation
Danziger
approved these changes
Sep 7, 2026
kernelwhisperer
added a commit
to cowprotocol/cowswap
that referenced
this pull request
Sep 10, 2026
# Summary Fixes: [FE-349](https://linear.app/cowswap/issue/FE-349/optimize-refreshes-to-fetch-only-twaps-that-changed) Depends on cowprotocol/cow-programmatic-orders-api#5 Depends on cowprotocol/cow-sdk#996 - Poll EOA TWAP parents every second (previously it was 10s), fetching only changes since the previous indexed block. - Merge changes into cached orders. - Refresh expanded parts when their parent changes, removing their separate polling timer. - Log the number of parent updates after each successful delta poll. # To Test 1. Place a TWAP 2. The `OPEN` part state should become observable, it should not jump directly to filled. # Background The indexer updates the parent’s `updatedAtBlock` when its parts change, including candidate-to-discrete transitions. Expanded parts therefore refresh through parent updates. The pagination total stays unchanged during delta polling. A full fetch, such as a page reload, refreshes it. <img width="3374" height="1206" alt="image" src="https://github.com/user-attachments/assets/5526ab3d-38d4-4179-9942-aba3fbb9892c" /> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Improvements** - TWAP order lists now refresh more efficiently by retrieving only orders that have changed. - Updates are detected promptly, helping order status and expanded order details stay current. - Existing order information is preserved when no changes are available, reducing unnecessary full refreshes. - **Bug Fixes** - Improved TWAP order refresh behavior so changes are reflected reliably without waiting for periodic full updates. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Reduce delays in TWAP part discovery and status updates. Previously, polling ran roughly every 50 seconds, so fast-filling parts could appear directly as filled.
Changes
CandidateConfirmerandOrderStatusTrackerevery block on all active chains.This increases Orderbook API traffic. Parts that fill between checks can still skip the visible Open state.
How to Test
Checklist
Breaking Changes
None
Related Issues
None