Skip to content

Dx/bring 30895de 08ada7a - #179

Merged
ZanCorDX merged 3 commits into
mainfrom
dx/bring-30895de-08ada7a
Mar 13, 2026
Merged

ZanCorDX merged 3 commits into
mainfrom
dx/bring-30895de-08ada7a

Conversation

@ZanCorDX

Copy link
Copy Markdown
Collaborator

#174
git cherry-pick 30895de

#175
git cherry-pick 08ada7a

ZanCorDX and others added 2 commits March 11, 2026 13:49
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.

---------

Co-authored-by: Jonas Bostoen <jonasbostoen@fastmail.com>
This PR adds a new parameter `disk_max_size_to_accept_user_rpc_mb`.
When the user RPC detects that the local DB backup size exceeds
`disk_max_size_to_accept_user_rpc_mb`, it starts rejecting flow.
This allows us to configure it to guarantee we never lose archive flow.
It also adds a metric for `disk_max_size_to_accept_user_rpc_mb `to allow
adding alarms easily.

---------

Co-authored-by: Jonas Bostoen <jonasbostoen@fastmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@ZanCorDX
ZanCorDX requested a review from fsodre March 11, 2026 19:11
Comment thread src/ingress/mod.rs
pub async fn listen(mut self, cancellation_token: CancellationToken) {
loop {
tokio::select! {
Some(req) = self.reply_socket.next() => {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Don't we need to treat None here? What happens if the socket drops?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yes!

Comment thread src/lib.rs
local_builder_url: builder_url,
builder_ready_endpoint,
indexer_handle,
disk_max_size_to_accept_user_rpc: args.disk_max_size_to_accept_user_rpc_mb * 1024 * 1024,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Should we use saturating_mul() here too?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

It will never reach that, but you are right, I'll change it.

Comment thread src/lib.rs
loop {
tokio::time::sleep(Duration::from_secs(60)).await;
ingress.maintenance().await;
info!("starting state maintenance!!");

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nit: shouldn't we show this log only when actually doing maintenance?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I'll remove that, we also trace inside the func

Comment thread src/utils.rs
pub const SHUTDOWN_TIMEOUT: Duration = Duration::from_secs(20);

/// Consider move this to rbuilder-utils.
/// Waits for critical_tasks to finish by themselves up to grateful_timeout.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nit: Should it be "graceful_timeout"?

@ZanCorDX
ZanCorDX merged commit fd082a1 into main Mar 13, 2026
4 checks passed
@ZanCorDX
ZanCorDX deleted the dx/bring-30895de-08ada7a branch March 13, 2026 11:54
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