mirror of
https://github.com/facebook/sapling.git
synced 2024-10-05 14:28:17 +03:00
commit_graph: add a sleep in update-preloaded command to prevent exiting before writing to all inner blobstores
Summary: In the case of a multiplexed blobstore, the put operation can exit after it succeeds in one inner blobstore before finishing in all, and leave the rest running in the background. This sleep tries to prevent exiting early before they all finish. Reviewed By: mitrandir77 Differential Revision: D46190037 fbshipit-source-id: ac2ae0d1453ebdc923170b9da7ca98df7519bf52
This commit is contained in:
parent
e95b17e5a6
commit
84661b9dd0
@ -53,6 +53,10 @@ pub struct UpdatePreloadedArgs {
|
|||||||
/// Sleep time between fetching changeset edges in milliseconds.
|
/// Sleep time between fetching changeset edges in milliseconds.
|
||||||
#[clap(long)]
|
#[clap(long)]
|
||||||
sleep_ms: u64,
|
sleep_ms: u64,
|
||||||
|
|
||||||
|
/// Sleep time before exiting the program in seconds.
|
||||||
|
#[clap(long, default_value_t = 60)]
|
||||||
|
sleep_before_exit_secs: u64,
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn try_fetch_chunk(
|
async fn try_fetch_chunk(
|
||||||
@ -185,6 +189,11 @@ pub(super) async fn update_preloaded(
|
|||||||
.put(ctx, args.blobstore_key, BlobstoreBytes::from_bytes(bytes))
|
.put(ctx, args.blobstore_key, BlobstoreBytes::from_bytes(bytes))
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
|
// In the case of a multiplexed blobstore, the put operation can exit after it succeeds
|
||||||
|
// in one inner blobstore before finishing in all, and leave the rest running in the
|
||||||
|
// background. This sleep tries to prevent exiting early before they all finish.
|
||||||
|
tokio::time::sleep(Duration::from_secs(args.sleep_before_exit_secs)).await;
|
||||||
|
|
||||||
println!("Uploaded updated preloaded edges to blobstore");
|
println!("Uploaded updated preloaded edges to blobstore");
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
Loading…
Reference in New Issue
Block a user