Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ members = [
]

[workspace.dependencies]
spawned-rt = { path = "rt", version = "0.4.0" }
spawned-concurrency = { path = "concurrency", version = "0.4.0" }
spawned-rt = { path = "rt", version = "0.4.1" }
spawned-concurrency = { path = "concurrency", version = "0.4.1" }
tracing = { version = "0.1.41", features = ["log"] }
tracing-subscriber = { version = "0.3.19", features = ["env-filter"] }

[workspace.package]
version = "0.4.0"
version = "0.4.1"
license = "MIT"
edition = "2021"
3 changes: 2 additions & 1 deletion concurrency/src/tasks/gen_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -328,12 +328,13 @@ mod warn_on_block {
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Self::Output> {
let type_id = std::any::type_name::<F>();
let task_id = rt::task_id();
let this = self.project();
let now = Instant::now();
let res = this.inner.poll(cx);
let elapsed = now.elapsed();
if elapsed > Duration::from_millis(10) {
warn!(future = ?type_id, elapsed = ?elapsed, "Blocking operation detected");
warn!(task = ?task_id, future = ?type_id, elapsed = ?elapsed, "Blocking operation detected");
}
res
}
Expand Down
2 changes: 1 addition & 1 deletion examples/busy_genserver_warning/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ impl GenServer for BusyWorker {
_: Self::CastMsg,
handle: &GenServerHandle<Self>,
) -> CastResponse {
info!("sleeping");
info!(taskid = ?rt::task_id(), "sleeping");
thread::sleep(Duration::from_millis(542));
handle.clone().cast(()).await.unwrap();
// This sleep is needed to yield control to the runtime.
Expand Down
2 changes: 1 addition & 1 deletion rt/src/tasks/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub use crate::tasks::tokio::oneshot;
pub use crate::tasks::tokio::sleep;
pub use crate::tasks::tokio::timeout;
pub use crate::tasks::tokio::CancellationToken;
pub use crate::tasks::tokio::{spawn, spawn_blocking, JoinHandle, Runtime};
pub use crate::tasks::tokio::{spawn, spawn_blocking, task_id, JoinHandle, Runtime};
pub use crate::tasks::tokio::{BroadcastStream, ReceiverStream};
use std::future::Future;

Expand Down
2 changes: 1 addition & 1 deletion rt/src/tasks/tokio/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pub mod oneshot;

pub use tokio::{
runtime::Runtime,
task::{spawn, spawn_blocking, JoinHandle},
task::{id as task_id, spawn, spawn_blocking, JoinHandle},
time::{sleep, timeout},
};
pub use tokio_stream::wrappers::{BroadcastStream, UnboundedReceiverStream as ReceiverStream};
Expand Down