Skip to content

Commit fb27f0a

Browse files
committed
fix
1 parent e3eb005 commit fb27f0a

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

scripts/tests/calibnet_other_check.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ fi
2727
forest_check_db_stats
2828
echo "Run snapshot GC"
2929
forest_run_snap_gc
30-
sleep 5
30+
forest_wait_api
3131
echo "Wait the node to sync"
3232
forest_wait_for_sync
3333
forest_check_db_stats

src/cli/subcommands/chain_cmd/prune.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,18 @@ use std::time::Duration;
88
#[derive(Debug, Subcommand)]
99
pub enum ChainPruneCommands {
1010
/// Run snapshot GC
11-
Snap,
11+
Snap {
12+
#[arg(long)]
13+
no_wait: bool,
14+
},
1215
}
1316

1417
impl ChainPruneCommands {
1518
pub async fn run(self, client: rpc::Client) -> anyhow::Result<()> {
1619
match self {
17-
Self::Snap => {
20+
Self::Snap { no_wait } => {
1821
client
19-
.call(ChainPruneSnapshot::request(())?.with_timeout(Duration::MAX))
22+
.call(ChainPruneSnapshot::request((!no_wait,))?.with_timeout(Duration::MAX))
2023
.await?;
2124
}
2225
}

src/rpc/methods/chain.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -196,22 +196,22 @@ impl RpcMethod<1> for ChainGetMessagesInTipset {
196196
}
197197

198198
pub enum ChainPruneSnapshot {}
199-
impl RpcMethod<0> for ChainPruneSnapshot {
199+
impl RpcMethod<1> for ChainPruneSnapshot {
200200
const NAME: &'static str = "Forest.SnapshotGC";
201-
const PARAM_NAMES: [&'static str; 0] = [];
201+
const PARAM_NAMES: [&'static str; 1] = ["blocking"];
202202
const API_PATHS: BitFlags<ApiPaths> = ApiPaths::all();
203203
const PERMISSION: Permission = Permission::Admin;
204204

205-
type Params = ();
205+
type Params = (bool,);
206206
type Ok = ();
207207

208208
async fn handle(
209209
_ctx: Ctx<impl Blockstore + Send + Sync + 'static>,
210-
(): Self::Params,
210+
(blocking,): Self::Params,
211211
) -> Result<Self::Ok, ServerError> {
212212
if let Some(gc) = crate::daemon::GLOBAL_SNAPSHOT_GC.get() {
213213
let progress_rx = gc.trigger();
214-
while progress_rx.recv_async().await.is_ok() {}
214+
while blocking && progress_rx.recv_async().await.is_ok() {}
215215
Ok(())
216216
} else {
217217
Err(anyhow::anyhow!("snapshot gc is not enabled").into())

0 commit comments

Comments
 (0)