Skip to content

Commit 58883d4

Browse files
kavehahmadi60facebook-github-bot
authored andcommitted
move OBC CLIENT initialization to backingstore
Summary: Move OBC API initialization to backing store. Currently, all the OBC bumps only used for scmstore counters which are all calling from Eden. Then for other sl command we don't need to initialize OBC API. This diff move the initialization to BackingStore instead of Repo Reviewed By: jdelliot Differential Revision: D67491615 fbshipit-source-id: 8573721bac15deccd0bbc32390a3da6ee47f5147
1 parent 9309802 commit 58883d4

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

eden/scm/lib/backingstore/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ sapling-edenapi = { version = "0.1.0", path = "../edenapi" }
2727
sapling-identity = { version = "0.1.0", path = "../identity" }
2828
sapling-indexedlog = { version = "0.1.0", path = "../indexedlog", features = ["configurable"] }
2929
sapling-manifest = { version = "0.1.0", path = "../manifest" }
30+
sapling-metrics = { version = "0.1.0", path = "../metrics" }
3031
sapling-repo = { version = "0.1.0", path = "../repo" }
3132
sapling-storemodel = { version = "0.1.0", path = "../storemodel" }
3233
sapling-tracing-collector = { version = "0.1.0", path = "../tracing-collector" }

eden/scm/lib/backingstore/src/backingstore.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ use edenapi::types::CommitId;
2828
use edenapi::BlockingResponse;
2929
use edenapi::RECENT_DOGFOODING_REQUESTS;
3030
use log::warn;
31+
use metrics::ods;
3132
use repo::repo::Repo;
3233
use repo::RepoMinimalInfo;
3334
use storemodel::BoxIterator;
@@ -148,6 +149,13 @@ impl BackingStore {
148149

149150
let config = repo.config().clone();
150151

152+
let is_obc_enabled = config.get_or::<bool>("scmstore", "enable-obc", || false)?;
153+
if is_obc_enabled {
154+
if let Err(err) = ods::initialize_obc_client() {
155+
tracing::warn!(?err, "error creating OBC client");
156+
}
157+
}
158+
151159
Ok(Inner {
152160
treestore,
153161
filestore,

eden/scm/lib/repo/src/repo.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ use edenapi::SaplingRemoteApi;
2727
use edenapi::SaplingRemoteApiError;
2828
use manifest_tree::ReadTreeManifest;
2929
use metalog::MetaLog;
30-
use metrics::ods;
3130
use once_cell::sync::OnceCell;
3231
use parking_lot::RwLock;
3332
use repo_minimal_info::constants::SUPPORTED_DEFAULT_REQUIREMENTS;
@@ -173,13 +172,6 @@ impl Repo {
173172

174173
let locker = Arc::new(RepoLocker::new(&config, store_path.clone())?);
175174

176-
let is_obc_enabled = config.get_or::<bool>("scmstore", "enable-obc", || false)?;
177-
if is_obc_enabled {
178-
if let Err(err) = ods::initialize_obc_client() {
179-
tracing::warn!(?err, "error creating OBC client");
180-
}
181-
}
182-
183175
Ok(Repo {
184176
path,
185177
ident,

0 commit comments

Comments
 (0)