Skip to content

Proper shutdown + clickhouse timeouts cfg#174

Merged
ZanCorDX merged 9 commits intomainfrom
dx/proper-shutdown
Feb 5, 2026
Merged

Proper shutdown + clickhouse timeouts cfg#174
ZanCorDX merged 9 commits intomainfrom
dx/proper-shutdown

Conversation

@ZanCorDX
Copy link
Collaborator

@ZanCorDX ZanCorDX commented Feb 4, 2026

This PR tries to improve a little the shutdown by properly waiting critical tasks with JoinHandles and cancelling infinite loops (locking resourses) with a CancellationToken.
It also add 2 new parameters indexer.clickhouse.send-timeout-ms/indexer.clickhouse.end-timeout-ms to configure clickhouse timeouts.

@metachris metachris requested a review from Copilot February 5, 2026 11:35
Copy link

Copilot AI left a comment

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 improves the shutdown process by implementing proper task cancellation with CancellationToken and waiting for critical tasks using JoinHandles. It also adds configurable timeout parameters for ClickHouse HTTP requests.

Changes:

  • Removed the runner module and moved its functionality directly into main.rs
  • Added CancellationToken to gracefully cancel infinite loops and JoinHandles to wait for critical tasks during shutdown
  • Added two new CLI parameters (send-timeout-ms and end-timeout-ms) to configure ClickHouse timeouts

Reviewed changes

Copilot reviewed 13 out of 14 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/runner/mod.rs Removed entire runner module
src/main.rs Moved runner functionality here and implemented improved shutdown with cancellation tokens and task waiting
src/lib.rs Updated function signatures to accept TaskExecutor, IndexerHandle, and CancellationToken instead of CliContext
src/utils.rs Added wait_for_critical_tasks helper function and SHUTDOWN_TIMEOUT constant
src/indexer/mod.rs Modified to return JoinHandles for proper shutdown waiting
src/indexer/click/mod.rs Updated to use new timeout parameters and return join handles
src/ingress/mod.rs Added cancellation token support to listen method
src/cli.rs Added send_timeout_ms and end_timeout_ms configuration parameters
tests/common/mod.rs Updated test helper to accept TaskManager parameter
tests/ingress.rs Updated test to create and pass TaskManager
tests/network.rs Updated test to create and pass TaskManager, changed IPv6 addresses to IPv4
src/indexer/click/models.rs Removed unnecessary .clone() call
Cargo.toml Updated rbuilder dependencies and added tokio-util

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

@ZanCorDX ZanCorDX merged commit 30895de into main Feb 5, 2026
4 checks passed
@ZanCorDX ZanCorDX deleted the dx/proper-shutdown branch February 5, 2026 21:17
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