Skip to content

Replay the testnet chain head while the indexer is idle - #200

Merged
AdamSpitz merged 1 commit into
devfrom
feature/indexer-idle-head-cache
Sep 28, 2026
Merged

AdamSpitz merged 1 commit into
devfrom
feature/indexer-idle-head-cache

Conversation

@AdamSpitz

Copy link
Copy Markdown
Owner

Summary

  • On Base Sepolia, keep Ponder's four-second poll timer but replay the last eth_getBlockByNumber("latest") for 30s while nobody is reading, so an idle indexer stops paying Alchemy for empty log polls.
  • A GraphQL or /api read, or POST /api/indexer-wake, opens a 60-second window of live polls. Health checks and /api/project-read-demand do not.
  • Off for mainnet unless INDEXER_IDLE_HEAD_CACHE=1. =0 disables it on testnet.

This is the indexer change only. It was committed on feature/delegation-copy-notes and cherry-picked here so that branch's notes do not ride along.

Test plan

  • npm run test --workspace=commonality-indexer (idle-head cache tests included; also re-ran in pre-commit)

Base Sepolia keeps Ponder's four-second timer but serves the last latest-block response for 30s unless a client read or POST /api/indexer-wake opens a one-minute live window.

@AdamSpitz AdamSpitz left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review receipt.

Reviewed the idle-head cache against Ponder's HTTP client (it posts a Request, and the wrapper clones that body). Latest-block replays are keyed by params and only stored for successful results. Wake is limited to GraphQL, SQL, GET /api, and POST /api/indexer-wake; health and project-read-demand stay quiet. No findings.

Reviewed-with: grok
Reviewed-files: 7
Reviewed-commit: cf694a9

@AdamSpitz
AdamSpitz merged commit 487b452 into dev Sep 28, 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