Skip to content

[256] Optimize poller throttling parameters in indexer_runner - #375

Merged
2 commits merged into
Goldii-locks:mainfrom
ToryMic:fix/256-optimize-poller-throttling-parameters-in-indexer_runner
Aug 30, 2026
Merged

[256] Optimize poller throttling parameters in indexer_runner#375
2 commits merged into
Goldii-locks:mainfrom
ToryMic:fix/256-optimize-poller-throttling-parameters-in-indexer_runner

Conversation

@ToryMic

@ToryMic ToryMic commented Aug 29, 2026

Copy link
Copy Markdown

Summary

Implements dynamic polling frequency intervals in indexer_runner based on ledger processing loads.

  • Adds indexer_runner-owned throttle parameters and state with env configuration
    (INDEXER_RUNNER_POLL_INTERVAL_MS, INDEXER_RUNNER_MIN/MAX_POLL_INTERVAL_MS,
    INDEXER_RUNNER_IDLE_MULTIPLIER, INDEXER_RUNNER_IDLE_THRESHOLD_CYCLES,
    INDEXER_RUNNER_LOAD_DECREASE_FACTOR).
  • adjustIndexerRunnerPollInterval() backs the polling wait delay up toward the
    max interval while the network is idle and pulls it back toward the min when
    events are processed.
  • The poll loop (poller.ts) now sizes its wait from the indexer_runner throttle.

Validation

  • Added tests asserting polling wait delays increase when the network is idle,
    including an integration test that drives pollEvents() through repeated idle
    cycles and asserts the delay grows.
  • tsc --noEmit, npm test (965 tests), and npm run build all pass.

Also includes small repairs to pre-existing CI failures so this branch is green.

Closes 256
Closes #256

ToryMic added 2 commits August 28, 2026 20:33
- Import jest from @jest/globals in failover-recovery tests that used the
  global (ReferenceError: jest is not defined)
- Drop fake-timer usage that captured the mocked setTimeout and hung
- Type logger.warn/debug spy calls to satisfy strict tsc
- Export SCHEMA_MANAGER_INDEXES from db.ts and import it in the schema
  manager test (ReferenceError)
- Make the Goldii-locks#186 migration-count assertion robust to future migrations
- Accept opts argument in the indexer-runner-historical-sync getEvents mock
…cks#256)

Implement dynamic polling frequency intervals in indexer_runner based on
ledger processing load:
- Add IndexerRunnerThrottleParameters / IndexerRunnerThrottleState with
  env-configured base/min/max intervals, idle multiplier, idle threshold
  and load decrease factor.
- adjustIndexerRunnerPollInterval(): the polling wait delay backs off
  (increases) toward the max when the network is idle and is pulled back
  toward the min when events are processed.
- Wire the poll loop (poller.ts) to size its sleep from the indexer_runner
  throttle instead of the generic db.ts throttle.

Add tests asserting polling wait delays increase while the network is idle,
including an integration test that drives pollEvents() through repeated idle
cycles.
@drips-wave

drips-wave Bot commented Aug 29, 2026

Copy link
Copy Markdown

@ToryMic Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@godamongstmen897 godamongstmen897 closed this pull request by merging all changes into Goldii-locks:main in 9e42e6f Aug 30, 2026
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.

Optimize poller throttling parameters in indexer_runner

2 participants