mirror of
https://github.com/facebook/sapling.git
synced 2024-10-04 22:07:44 +03:00
Log generation difference in SCS commit_compare
Summary: As discussed offline with mitrandir77 and andreacampi, this is far from a perfect solution, but it might help us drill down on which clients are overloading SCS services. Reviewed By: mitrandir77 Differential Revision: D56572549 fbshipit-source-id: 485b3afdb29d8b3d31b280c48a0aa76680f0fbc6
This commit is contained in:
parent
a3eb5506ca
commit
825668bf3d
@ -576,12 +576,12 @@ impl SourceControlServiceImpl {
|
||||
let (base_changeset, other_changeset) = match ¶ms.other_commit_id {
|
||||
Some(id) => {
|
||||
let (_repo, mut base_changeset, other_changeset) =
|
||||
self.repo_changeset_pair(ctx, &commit, id).await?;
|
||||
self.repo_changeset_pair(ctx.clone(), &commit, id).await?;
|
||||
add_mutable_renames(&mut base_changeset, ¶ms).await?;
|
||||
(base_changeset, Some(other_changeset))
|
||||
}
|
||||
None => {
|
||||
let (repo, mut base_changeset) = self.repo_changeset(ctx, &commit).await?;
|
||||
let (repo, mut base_changeset) = self.repo_changeset(ctx.clone(), &commit).await?;
|
||||
add_mutable_renames(&mut base_changeset, ¶ms).await?;
|
||||
let other_changeset = self
|
||||
.find_commit_compare_parent(&repo, &mut base_changeset, ¶ms)
|
||||
@ -590,6 +590,23 @@ impl SourceControlServiceImpl {
|
||||
}
|
||||
};
|
||||
|
||||
// Log the generation difference to drill down on clients making
|
||||
// expensive `commit_compare` requests
|
||||
let base_generation = base_changeset.generation().await?.value();
|
||||
let other_generation = match other_changeset {
|
||||
Some(ref cs) => cs.generation().await?.value(),
|
||||
// If there isn't another commit, let's use the same generation
|
||||
// to have a difference of 0.
|
||||
None => base_generation,
|
||||
};
|
||||
|
||||
let generation_diff = base_generation.abs_diff(other_generation);
|
||||
let mut scuba = ctx.scuba().clone();
|
||||
scuba.log_with_msg(
|
||||
"Commit compare generation difference",
|
||||
format!("{generation_diff}"),
|
||||
);
|
||||
|
||||
let mut last_path = None;
|
||||
let mut diff_items: BTreeSet<_> = params
|
||||
.compare_items
|
||||
|
Loading…
Reference in New Issue
Block a user