From 1578bab64b0a0e76041bfe0b806344b542ccce27 Mon Sep 17 00:00:00 2001 From: hanabi1224 Date: Mon, 29 Jun 2026 22:17:58 +0800 Subject: [PATCH] fix: make diff snapshot export cancellable --- src/tool/subcommands/archive_cmd.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/tool/subcommands/archive_cmd.rs b/src/tool/subcommands/archive_cmd.rs index 4b5c78e2b77..59e52a3f61e 100644 --- a/src/tool/subcommands/archive_cmd.rs +++ b/src/tool/subcommands/archive_cmd.rs @@ -598,7 +598,14 @@ where diff_limit, FileBackedCidHashSet::new_in_temp_dir()?, ); - while stream.try_next().await?.is_some() {} + let mut i: usize = 0; + while stream.try_next().await?.is_some() { + i += 1; + if i.is_multiple_of(128) { + // To make the task cancellable + tokio::task::yield_now().await; + } + } stream.into_seen() } else { FileBackedCidHashSet::new_in_temp_dir()?