Skip to content

Commit 01b6a2f

Browse files
mononoke: init cachelib only once and add more logging
Summary: Initializing twice causes it to fail. Let's not do that, and also let's use init_mononoke function instead of our adhoc logger and runtime creationg (at the very least it also initializes tunables and sets correct tokio runtime parameters). Also let's add more logging to see the progress of uploading Reviewed By: ahornby Differential Revision: D27079673 fbshipit-source-id: 940135a9aed62f7139835b2450a1964b879e814b
1 parent 2e3b7d0 commit 01b6a2f

File tree

1 file changed

+10
-4
lines changed
  • eden/mononoke/streaming_clone/src

1 file changed

+10
-4
lines changed

eden/mononoke/streaming_clone/src/main.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ pub async fn streaming_clone<'a>(
4040
logger: Logger,
4141
matches: &'a MononokeMatches<'a>,
4242
) -> Result<(), Error> {
43-
args::init_cachelib(fb, &matches);
4443
let ctx = CoreContext::new_with_logger(fb, logger.clone());
4544
let repo = args::open_repo(fb, &logger, &matches).await?;
4645

@@ -221,6 +220,15 @@ async fn upload_chunks_blobstore<'a>(
221220
}
222221
}))
223222
.buffered(10)
223+
.inspect({
224+
let mut i = 0;
225+
move |_| {
226+
i += 1;
227+
if i % 100 == 0 {
228+
info!(ctx.logger(), "uploaded {}", i);
229+
}
230+
}
231+
})
224232
.try_collect::<Vec<_>>()
225233
.await?;
226234

@@ -438,9 +446,7 @@ fn main(fb: FacebookInit) -> Result<(), Error> {
438446
))
439447
.get_matches();
440448

441-
args::init_cachelib(fb, &matches);
442-
let logger = args::init_logging(fb, &matches)?;
443449

444-
let mut runtime = tokio::runtime::Runtime::new()?;
450+
let (_, logger, mut runtime) = args::init_mononoke(fb, &matches)?;
445451
runtime.block_on(streaming_clone(fb, logger, &matches))
446452
}

0 commit comments

Comments
 (0)