Skip to content

Add REST Endpoint /health to sender crate with configurable port#92

Open
Sajjon wants to merge 1 commit into
mainfrom
cyon/health_endpoint
Open

Add REST Endpoint /health to sender crate with configurable port#92
Sajjon wants to merge 1 commit into
mainfrom
cyon/health_endpoint

Conversation

@Sajjon

@Sajjon Sajjon commented Nov 5, 2025

Copy link
Copy Markdown
Contributor

Adds a REST endpoint to sender crate.

You can cherry pick commit: Sajjon@bdbd423

@Sajjon Sajjon requested a review from sandreim November 5, 2025 12:12
Comment thread utils/sender/src/main.rs Outdated
@Sajjon Sajjon force-pushed the cyon/health_endpoint branch from c4a6109 to cf57946 Compare November 6, 2025 08:59
Comment thread utils/sender/src/main.rs
}

let health_node_url = args.node_url.clone();
spawn_healthcheck_server(args.health_port, move || create_api(health_node_url.clone()));

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.

This will pass in a different API instance than the one used in the sender. Please check that we createa a new one at line 257.

Comment thread utils/sender/src/main.rs
Value { value: ValueDef::Primitive(Primitive::U128(u128::MAX)), context: () };

async fn health_handler(State(api): State<Arc<OnlineClient<PolkadotConfig>>>) -> StatusCode {
match api.backend().latest_finalized_block_ref().await {

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.

This will not cover all cases. Due to some other errors the tx sending loop could get stuck or not able to reconnect. This has happened before.

My suggestion is to actually look if we are able to push transactions to the chain. If we can't do it for say 30s, we should return that service is not available.

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