Skip to content

Commit 4a74e6a

Browse files
gustavoavenafacebook-github-bot
authored andcommitted
Log errors from backsyncer and forward syncer to stderr and scuba
Summary: Sev follow-up: T215802716 This will log the error to Scuba and stderr. Reviewed By: andreacampi Differential Revision: D71544949 fbshipit-source-id: ac0f112e8c06a8852e17c75875ed889b0cea9d98
1 parent 11e5a56 commit 4a74e6a

2 files changed

Lines changed: 15 additions & 3 deletions

File tree

  • eden/mononoke/commit_rewriting

eden/mononoke/commit_rewriting/backsyncer/backsyncer_cmd/main.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ async fn async_main(ctx: CoreContext, app: MononokeApp) -> Result<(), Error> {
4343
let repo_args = args.repo_args.clone();
4444
let runtime = app.runtime().clone();
4545

46-
if let Some(mut executor) = args.sharded_executor_args.clone().build_executor(
46+
let res = if let Some(mut executor) = args.sharded_executor_args.clone().build_executor(
4747
app.fb,
4848
runtime.clone(),
4949
ctx.logger(),
@@ -60,7 +60,13 @@ async fn async_main(ctx: CoreContext, app: MononokeApp) -> Result<(), Error> {
6060
.context("Source and Target repos must be provided when running in non-sharded mode")?;
6161
let process_executor = BacksyncProcessExecutor::new(ctx.clone(), app, repo_args).await?;
6262
process_executor.execute().await
63+
};
64+
65+
if let Err(ref e) = res {
66+
let mut scuba = ctx.scuba().clone();
67+
scuba.log_with_msg("Execution error", e.to_string());
6368
}
69+
res
6470
}
6571

6672
#[fbinit::main]

eden/mononoke/commit_rewriting/mononoke_x_repo_sync_job/src/main.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,7 @@ async fn async_main(app: MononokeApp, ctx: CoreContext) -> Result<(), Error> {
558558
let repo_args = args.repo_args.clone();
559559
let runtime = app.runtime().clone();
560560
let logger = app.logger().clone();
561-
if let Some(mut executor) = args.sharded_executor_args.clone().build_executor(
561+
let res = if let Some(mut executor) = args.sharded_executor_args.clone().build_executor(
562562
app.fb,
563563
runtime.clone(),
564564
&logger,
@@ -580,9 +580,15 @@ async fn async_main(app: MononokeApp, ctx: CoreContext) -> Result<(), Error> {
580580
.into_source_and_target_args()
581581
.context("Source and Target repos must be provided when running in non-sharded mode")?;
582582
let x_repo_process_executor =
583-
XRepoSyncProcessExecutor::new(app, ctx, args, &repo_args).await?;
583+
XRepoSyncProcessExecutor::new(app, ctx.clone(), args, &repo_args).await?;
584584
x_repo_process_executor.execute().await
585+
};
586+
587+
if let Err(ref e) = res {
588+
let mut scuba = ctx.scuba().clone();
589+
scuba.log_with_msg("Execution error", e.to_string());
585590
}
591+
res
586592
}
587593

588594
struct BackpressureParams {

0 commit comments

Comments
 (0)