Skip to content

Add clickhouse timeout#293

Merged
YaroShkvorets merged 3 commits into
mainfrom
fix/add-clickhouse-timeout
May 1, 2026
Merged

Add clickhouse timeout#293
YaroShkvorets merged 3 commits into
mainfrom
fix/add-clickhouse-timeout

Conversation

@YaroShkvorets
Copy link
Copy Markdown
Member

This pull request introduces a configurable timeout for ClickHouse HTTP requests to prevent indefinitely hung queries, particularly addressing issues when running under Bun. It also updates the documentation and configuration files to support this new setting. Additionally, there are various formatting improvements and minor test refactors for better readability and maintainability.

ClickHouse request timeout improvements:

  • Added a new environment variable CLICKHOUSE_REQUEST_TIMEOUT_MS (default: 30,000ms) to control the timeout for ClickHouse HTTP requests, with documentation explaining its importance and usage. [1] [2] [3]
  • Updated ClickHouse client creation in lib/clickhouse.ts to use the new timeout value for all client instances. [1] [2] [3]
  • Implemented timeout logic in the query function to abort requests that exceed the configured timeout, ensuring resources are cleaned up and errors are tracked appropriately. [1] [2] [3]

Documentation:

  • Updated docs/CONFIGURATION.md to document the new CLICKHOUSE_REQUEST_TIMEOUT_MS environment variable, its default value, and guidance for users.

Test and formatting improvements:

  • Reformatted and improved readability of test data and mock responses in Polymarket service tests, including breaking up long lines and consistently formatting objects and arrays. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12]
  • Minor formatting fix in lib/logger.ts for improved code style consistency.

- Add CLICKHOUSE_REQUEST_TIMEOUT_MS config (default 30s)
- Apply timeout to all ClickHouse client instances (query, insert, setup)
- Implement AbortController-based timeout for query() operations
- Add launch.json to .gitignore
@YaroShkvorets YaroShkvorets merged commit d5a9c32 into main May 1, 2026
1 check 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