Skip to content

Commit

Permalink
Remove tokio_shim
Browse files Browse the repository at this point in the history
Summary: Not needed anymore since we don't use tokio 0.x.

Reviewed By: dtolnay

Differential Revision: D52063174

fbshipit-source-id: 8505d1f02a06570b516bac13ddfb75ae135be895
  • Loading branch information
zertosh authored and facebook-github-bot committed Dec 12, 2023
1 parent f3e0371 commit bec19e8
Show file tree
Hide file tree
Showing 12 changed files with 15 additions and 22 deletions.
1 change: 0 additions & 1 deletion eden/mononoke/benchmarks/filestore/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,3 @@ rand = { version = "0.8", features = ["small_rng"] }
throttledblob = { version = "0.1.0", path = "../../blobstore/throttledblob" }
tokio = { version = "1.29.1", features = ["full", "test-util", "tracing"] }
tokio-util = { version = "0.7.8", features = ["full"] }
tokio_shim = { version = "0.1.0", git = "https://github.com/facebookexperimental/rust-shed.git", branch = "main" }
1 change: 0 additions & 1 deletion eden/mononoke/benchmarks/filestore/TARGETS
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ rust_binary(
"//common/rust/shed/cachelib_stub:cachelib",
"//common/rust/shed/fbinit:fbinit",
"//common/rust/shed/futures_stats:futures_stats",
"//common/rust/shed/tokio_shim:tokio_shim",
"//eden/mononoke/blobstore:blobstore",
"//eden/mononoke/blobstore:blobstore_factory",
"//eden/mononoke/blobstore:cacheblob",
Expand Down
2 changes: 1 addition & 1 deletion eden/mononoke/benchmarks/filestore/benchmark_filestore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ async fn run_benchmark_filestore<'a>(

match args.delay {
Some(delay) => {
tokio_shim::time::sleep(Duration::from_secs(delay)).await;
tokio::time::sleep(Duration::from_secs(delay)).await;
}
None => {}
}
Expand Down
3 changes: 1 addition & 2 deletions eden/mononoke/common/async_limiter/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ anyhow = "1.0.75"
futures = { version = "0.3.28", features = ["async-await", "compat"] }
governor = "0.3.2"
thiserror = "1.0.49"
tokio_shim = { version = "0.1.0", git = "https://github.com/facebookexperimental/rust-shed.git", branch = "main" }
tokio = { version = "1.29.1", features = ["full", "test-util", "tracing"] }

[dev-dependencies]
nonzero_ext = "0.2"
tokio = { version = "1.29.1", features = ["full", "test-util", "tracing"] }
3 changes: 1 addition & 2 deletions eden/mononoke/common/async_limiter/TARGETS
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,12 @@ rust_library(
},
test_deps = [
"fbsource//third-party/rust:nonzero_ext",
"fbsource//third-party/rust:tokio",
],
deps = [
"fbsource//third-party/rust:anyhow",
"fbsource//third-party/rust:futures",
"fbsource//third-party/rust:governor",
"fbsource//third-party/rust:thiserror",
"//common/rust/shed/tokio_shim:tokio_shim",
"fbsource//third-party/rust:tokio",
],
)
2 changes: 1 addition & 1 deletion eden/mononoke/common/async_limiter/src/async_limiter_.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ impl AsyncLimiter {
let (dispatch, dispatch_recv) = mpsc::unbounded();
let (cancel, cancel_recv) = mpsc::channel(1);

tokio_shim::task::spawn(async move {
tokio::task::spawn(async move {
let worker = dispatch_recv
.zip(futures::stream::select(
cancel_recv,
Expand Down
3 changes: 0 additions & 3 deletions eden/mononoke/facebook/lib.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ def tokio_dependency_test(name, rule):
# This is fine because that crate depends on Tokio 1.0 only for a
# trait impl on a foreign type. It's not used at runtime.
"//common/rust/srserver:srserver",
# This is fine because that crate depends on various Tokio
# versions but checks which one is which at runtime.
"//common/rust/shed/tokio_shim:tokio_shim",
# This provides a 0.1 version.
"//common/rust/shed/stats:stats",
# This has modules for tokio 0.1, 0.2 and 1.x It doesn't actually
Expand Down
1 change: 0 additions & 1 deletion eden/mononoke/git/git-pool/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,3 @@ git2 = "0.14"
num_cpus = "1.16"
r2d2 = "0.8.8"
tokio = { version = "1.29.1", features = ["full", "test-util", "tracing"] }
tokio_shim = { version = "0.1.0", git = "https://github.com/facebookexperimental/rust-shed.git", branch = "main" }
1 change: 0 additions & 1 deletion eden/mononoke/git/git-pool/TARGETS
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,5 @@ rust_library(
"fbsource//third-party/rust:num_cpus",
"fbsource//third-party/rust:r2d2",
"fbsource//third-party/rust:tokio",
"//common/rust/shed/tokio_shim:tokio_shim",
],
)
2 changes: 1 addition & 1 deletion eden/mononoke/git/git-pool/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ impl GitPool {
// Note - this tokio::spawn() is an attempt to fix deadlock D31541432.
let ret = tokio::spawn(async move {
let permit = sem.acquire_owned().await?;
let ret = tokio_shim::task::spawn_blocking(move || {
let ret = tokio::task::spawn_blocking(move || {
let result_repo = pool.get()?;
let repo = match &*result_repo {
Ok(repo) => repo,
Expand Down
2 changes: 1 addition & 1 deletion eden/mononoke/scs_server/TARGETS
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ rust_binary(
"fbsource//third-party/rust:serde_json",
"fbsource//third-party/rust:slog",
"fbsource//third-party/rust:tokio",
"fbsource//third-party/rust:tokio-stream",
"//common/rust/everstore:everstore_client",
"//common/rust/identity:identity",
"//common/rust/shed/borrowed:borrowed",
Expand All @@ -39,7 +40,6 @@ rust_binary(
"//common/rust/shed/panichandler:panichandler",
"//common/rust/shed/stats:stats",
"//common/rust/shed/time_ext:time_ext",
"//common/rust/shed/tokio_shim:tokio_shim",
"//common/rust/srserver:srserver",
"//configerator/structs/common/fbtype:fbtypes-rust",
"//eden/mononoke/blobstore:ephemeral_blobstore",
Expand Down
16 changes: 9 additions & 7 deletions eden/mononoke/scs_server/src/monitoring.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@ use slog::warn;
const SUBMIT_STATS_ONCE_PER_SECS: u64 = 10;

pub async fn monitoring_stats_submitter(ctx: CoreContext, mononoke: Arc<Mononoke>) {
tokio_shim::time::interval_stream(Duration::from_secs(SUBMIT_STATS_ONCE_PER_SECS))
.for_each(|_| async {
if let Err(e) = mononoke.report_monitoring_stats(&ctx).await {
warn!(ctx.logger(), "Failed to report monitoring stats: {:#?}", e);
}
})
.await;
tokio_stream::wrappers::IntervalStream::new(tokio::time::interval(Duration::from_secs(
SUBMIT_STATS_ONCE_PER_SECS,
)))
.for_each(|_| async {
if let Err(e) = mononoke.report_monitoring_stats(&ctx).await {
warn!(ctx.logger(), "Failed to report monitoring stats: {:#?}", e);
}
})
.await;
}

0 comments on commit bec19e8

Please sign in to comment.