Skip to content

feat: quicker orderbook api polling - #5

Merged
kernelwhisperer merged 1 commit into
mainfrom
feat/quicker-orderbook-api-polling
Sep 7, 2026
Merged

feat: quicker orderbook api polling#5
kernelwhisperer merged 1 commit into
mainfrom
feat/quicker-orderbook-api-polling

Conversation

@kernelwhisperer

Copy link
Copy Markdown
Collaborator

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

  • Run CandidateConfirmer and OrderStatusTracker every block on all active chains.
  • Reduce polling intervals to approximately 5 seconds on Gnosis and 12 seconds on Mainnet.
  • Keep other handlers unchanged.

This increases Orderbook API traffic. Parts that fill between checks can still skip the visible Open state.

How to Test

  1. Connect the frontend to a fully synced indexer with this change. (I did this locally)
  2. Create a TWAP and expand its parts.
  3. Verify that an accepted part appears as Open.
image

Checklist

  • Tests pass locally
  • Linting passes
  • Documentation updated (if needed)
  • Breaking changes documented (if any)

Breaking Changes

None

Related Issues

None

@kernelwhisperer kernelwhisperer self-assigned this Sep 7, 2026
@kernelwhisperer
kernelwhisperer merged commit 42dc840 into main Sep 7, 2026
4 checks passed
@kernelwhisperer
kernelwhisperer deleted the feat/quicker-orderbook-api-polling branch September 7, 2026 12:12
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 -->
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.

2 participants