Skip to content

Introduce PONDER_STATEMENT_TIMEOUT setting to ponder app#2219

Merged
tk-o merged 2 commits into
mainfrom
fix/ponder-pool-statement
Jun 30, 2026
Merged

Introduce PONDER_STATEMENT_TIMEOUT setting to ponder app#2219
tk-o merged 2 commits into
mainfrom
fix/ponder-pool-statement

Conversation

@tk-o

@tk-o tk-o commented May 29, 2026

Copy link
Copy Markdown
Member

This aims to resolve the database performance issue where some important internal poder queries fail due to 2 minutes statement timeout. We need to try increasing the statement timeout for the PG Pool connections.

Lite PR

Tip: Review docs on the ENSNode PR process

Summary

  • There was a patch created for ponder dependency where the hardcoded SQL statement timeout got replace with the PONDER_STATEMENT_TIMEOUT env var read (optional, defaults to the previously hardcoded value of 2 minutes).

Why

  • ENSIndexer Alpha instances have displayed an issue across all environments where an SQL statement timeout makes the ENSIndexer instance to crash.
  • Currently, the ENSIndexer Alpha in the yellow env suffers from this issue
    10:10:09.658 WARN  Failed database query query_id=bf6a582b retry_count=9 (2m 00s)
    error: canceling statement due to statement timeout
    

Testing

  • I tested the patch some weeks earlier and it worked just fine. More details here.

Notes for Reviewer (Optional)

  • This branch is aligned with the ENSNode v1.16.0 release, so that we can apply it dynamically to the yellow env.
    • The first commit fb3f45f after the ENSNode v1.16.0 was used for the base of this PR.

Pre-Review Checklist (Blocking)

  • This PR does not introduce significant changes and is low-risk to review quickly.
  • Relevant changesets are included (or are not required)

Copilot AI review requested due to automatic review settings May 29, 2026 04:43
@changeset-bot

changeset-bot Bot commented May 29, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 7ad964a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 22 packages
Name Type
ensindexer Patch
ensadmin Patch
ensrainbow Patch
ensapi Patch
fallback-ensapi Patch
enssdk Patch
enscli Patch
enskit Patch
ensskills Patch
@ensnode/datasources Patch
@ensnode/ensrainbow-sdk Patch
@ensnode/ensdb-sdk Patch
@ensnode/ensnode-sdk Patch
@ensnode/integration-test-env Patch
@ensnode/ponder-sdk Patch
@ensnode/ponder-subgraph Patch
@ensnode/shared-configs Patch
@docs/ensnode Patch
@docs/ensrainbow Patch
@namehash/ens-referrals Patch
@namehash/namehash-ui Patch
@ensnode/ensindexer-perf-testing Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel

vercel Bot commented May 29, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
admin.ensnode.io Ready Ready Preview, Comment Jun 26, 2026 10:21am
enskit-react-example.ensnode.io Ready Ready Preview, Comment Jun 26, 2026 10:21am
ensnode.io Ready Ready Preview, Comment Jun 26, 2026 10:21am
ensrainbow.io Ready Ready Preview, Comment Jun 26, 2026 10:21am

@coderabbitai

coderabbitai Bot commented May 29, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 65b76761-7c10-43ab-a269-4d1223d8c516

📥 Commits

Reviewing files that changed from the base of the PR and between 5072cc0 and 7ad964a.

📒 Files selected for processing (1)
  • .changeset/moody-wasps-flow.md

📝 Walkthrough

Walkthrough

This PR makes Ponder’s Postgres statement timeout configurable through PONDER_STATEMENT_TIMEOUT, registers the patch in package.json, and adds a changeset for the ensindexer patch release.

Changes

Ponder Statement Timeout Environment Configuration

Layer / File(s) Summary
Statement timeout configuration
patches/ponder@0.16.6.patch, package.json, .changeset/moody-wasps-flow.md
The patch reads PONDER_STATEMENT_TIMEOUT with a default, logs the resolved timeout, uses it for pg.Pool, registers the patch in pnpm.patchedDependencies, and adds a patch changeset for ensindexer.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A timeout patch hops into place,
With env var clues and a steady pace.
Two minutes by default, or your chosen light,
The pool waits kindly through the night.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: adding a PONDER_STATEMENT_TIMEOUT setting to ponder.
Description check ✅ Passed The description follows the required template and covers Summary, Why, Testing, Notes, and the checklist.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/ponder-pool-statement

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces a pnpm patch to the ponder dependency so ENSNode’s Ponder-based indexing can use a configurable Postgres statement_timeout via a new PONDER_STATEMENT_TIMEOUT environment variable, addressing failures caused by the hard-coded 2-minute timeout.

Changes:

  • Adds a pnpm patch for ponder@0.16.6 to source statement_timeout from process.env.PONDER_STATEMENT_TIMEOUT (instead of a fixed 2 minutes) and log the effective config.
  • Registers the patch in root package.json pnpm.patchedDependencies.
  • Updates pnpm-lock.yaml to include the patch hash and patched resolution.

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.

File Description
patches/ponder@0.16.6.patch Patches Ponder’s Postgres pool creation to use an env-configurable statement_timeout.
package.json Adds ponder@0.16.6 to pnpm.patchedDependencies.
pnpm-lock.yaml Records the patched dependency metadata and updated resolution.
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread patches/ponder@0.16.6.patch Outdated
Comment thread patches/ponder@0.16.6.patch Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@patches/ponder`@0.16.6.patch:
- Line 9: The new statementTimeout value is created with
Number(process.env.PONDER_STATEMENT_TIMEOUT) which yields NaN for non-numeric
env values; update the initialization around statementTimeout to validate and
coerce the environment input (process.env.PONDER_STATEMENT_TIMEOUT) to a safe
integer and fall back to the default (2 * 60 * 1000) when parsing fails or
results in NaN or non-positive values, then pass that validated numeric value
into the pg.Pool config; reference the statementTimeout constant and the
PONDER_STATEMENT_TIMEOUT env var when making this change.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 47615901-69ce-4a15-993e-9f4b32359631

📥 Commits

Reviewing files that changed from the base of the PR and between 493b4b6 and 5072cc0.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (2)
  • package.json
  • patches/ponder@0.16.6.patch

Comment thread patches/ponder@0.16.6.patch Outdated
@github-actions

github-actions Bot commented May 29, 2026

Copy link
Copy Markdown
Contributor

🚀 Preview Packages - fix/ponder-pool-statement

NPM Packages:

# Install latest preview for this branch
pnpm add @ensnode/datasources@preview-fix-ponder-pool-statement
pnpm add @ensnode/ensrainbow-sdk@preview-fix-ponder-pool-statement
pnpm add @ensnode/ensdb-sdk@preview-fix-ponder-pool-statement
pnpm add @ensnode/ensnode-sdk@preview-fix-ponder-pool-statement
pnpm add @ensnode/ponder-sdk@preview-fix-ponder-pool-statement
pnpm add @ensnode/ponder-subgraph@preview-fix-ponder-pool-statement
pnpm add @ensnode/ens-referrals@preview-fix-ponder-pool-statement
pnpm add @ensnode/namehash-ui@preview-fix-ponder-pool-statement

# Or install specific version
pnpm add @ensnode/ensnode-sdk@0.0.0-preview-fix-ponder-pool-statement-20260626102735

Docker Images:

docker pull ghcr.io/namehash/ensnode/ensindexer:preview-fix-ponder-pool-statement-7ad964a8
docker pull ghcr.io/namehash/ensnode/ensadmin:preview-fix-ponder-pool-statement-7ad964a8
docker pull ghcr.io/namehash/ensnode/ensapi:preview-fix-ponder-pool-statement-7ad964a8
docker pull ghcr.io/namehash/ensnode/ensrainbow:preview-fix-ponder-pool-statement-7ad964a8

Build Info:

  • 🎯 Target: 📦 NPM packages + 🐳 Docker images
  • 📦 Version: 0.0.0-preview-fix-ponder-pool-statement-20260626102735
  • 📝 Commit: 7ad964a8
  • 🌿 Branch: fix/ponder-pool-statement
  • ⏰ Built: 2026-06-26 10:34:29 UTC
  • 🔗 Workflow Run

🤖 This comment will be updated on subsequent publishing of release previews from the branch associated with this PR

Note: Preview packages are managed by changesets. NPM dist-tags can be cleaned up manually using npm dist-tag rm @ensnode/ensnode-sdk preview-fix-ponder-pool-statement

This aims to resolve the database performance issue where some important internal poder queries fail due to 2 minutes statement timeout. We need to try increasing the statement timeout for the PG Pool connections.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 4 changed files in this pull request and generated no new comments.

Files not reviewed (1)
  • pnpm-lock.yaml: Generated file

@tk-o

tk-o commented Jun 26, 2026

Copy link
Copy Markdown
Member Author

@greptile review

@greptile-apps

greptile-apps Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR makes the Ponder database statement timeout configurable. The main changes are:

  • Adds a ponder@0.16.6 patch for PONDER_STATEMENT_TIMEOUT.
  • Keeps the previous two-minute default when the setting is unset or blank.
  • Validates the setting as a non-negative integer in milliseconds.
  • Registers the patch in package.json and pnpm-lock.yaml.
  • Adds a patch changeset for ensindexer.

Confidence Score: 5/5

This looks safe to merge.

  • No blocking issues found in the changed code.

Important Files Changed

Filename Overview
patches/ponder@0.16.6.patch Adds environment-based parsing, validation, logging, and application of the Ponder pool statement timeout.
package.json Registers the new Ponder package patch with pnpm.
pnpm-lock.yaml Updates lockfile metadata so the Ponder patch is applied.
.changeset/moody-wasps-flow.md Adds a patch changeset for the new configurable timeout setting.

Reviews (2): Last reviewed commit: "docs(changeset): Introduced `PONDER_STAT..." | Re-trigger Greptile

Comment thread patches/ponder@0.16.6.patch
Comment thread patches/ponder@0.16.6.patch
@tk-o tk-o marked this pull request as ready for review June 26, 2026 12:03
@tk-o tk-o requested a review from a team as a code owner June 26, 2026 12:03
@tk-o tk-o merged commit db70772 into main Jun 30, 2026
29 checks passed
@tk-o tk-o deleted the fix/ponder-pool-statement branch June 30, 2026 10:45
@github-actions github-actions Bot mentioned this pull request Jun 29, 2026
@coderabbitai coderabbitai Bot mentioned this pull request Jul 3, 2026
2 tasks
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.

3 participants