Skip to content

Commit

Permalink
Fix broken build for non async-trait builds (#302)
Browse files Browse the repository at this point in the history
  • Loading branch information
slawlor authored Dec 18, 2024
1 parent f15be0c commit 6842be7
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 10 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ jobs:
- name: Run the default tests
package: ractor
# flags:
- name: Test ractor without async-trait
package: ractor
flags: --no-default-features -F tokio_runtime,message_span_propogation
- name: Test ractor without span propogation
package: ractor
flags: --no-default-features -F tokio_runtime,async-trait
Expand Down
2 changes: 1 addition & 1 deletion ractor/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ractor"
version = "0.14.0"
version = "0.14.1"
authors = ["Sean Lawlor", "Evan Au", "Dillon George"]
description = "A actor framework for Rust"
documentation = "https://docs.rs/ractor"
Expand Down
17 changes: 10 additions & 7 deletions ractor/src/factory/worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
use std::collections::{HashMap, VecDeque};
use std::fmt::Debug;
#[cfg(not(feature = "async-trait"))]
use std::future::Future;
use std::sync::Arc;

use bon::Builder;
Expand Down Expand Up @@ -336,8 +338,9 @@ where
custom_start,
}: Self::Arguments,
) -> impl Future<Output = Result<Self::State, ActorProcessingErr>> + Send {
let inner_state = <Self as Worker>::pre_start(&self, wid, &factory, custom_start).await?;
async {
async move {
let inner_state =
<Self as Worker>::pre_start(&self, wid, &factory, custom_start).await?;
Ok(Self::State {
wid,
factory,
Expand All @@ -352,7 +355,7 @@ where
_: ActorRef<Self::Msg>,
state: &mut Self::State,
) -> impl Future<Output = Result<(), ActorProcessingErr>> + Send {
async {
async move {
<Self as Worker>::post_start(&self, state.wid, &state.factory, &mut state.state).await
}
}
Expand All @@ -372,7 +375,7 @@ where
_: ActorRef<Self::Msg>,
state: &mut Self::State,
) -> impl Future<Output = Result<(), ActorProcessingErr>> + Send {
async {
async move {
<Self as Worker>::post_stop(&self, state.wid, &state.factory, &mut state.state).await
}
}
Expand All @@ -393,7 +396,7 @@ where
message: Self::Msg,
state: &mut Self::State,
) -> impl Future<Output = Result<(), ActorProcessingErr>> + Send {
async {
async move {
match message {
WorkerMessage::FactoryPing(time) => {
tracing::trace!("Worker {} - ping", state.wid);
Expand All @@ -403,7 +406,7 @@ where
.cast(FactoryMessage::WorkerPong(state.wid, time.elapsed()))?;
}
WorkerMessage::Dispatch(mut job) => {
let key = if let Some(span) = job.options.span.take() {
let key = if let Some(span) = job.options.take_span() {
<Self as Worker>::handle(
&self,
state.wid,
Expand All @@ -426,9 +429,9 @@ where
state
.factory
.cast(FactoryMessage::Finished(state.wid, key))?;
Ok(())
}
}
Ok(())
}
}

Expand Down
2 changes: 1 addition & 1 deletion ractor_cluster/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ractor_cluster"
version = "0.14.0"
version = "0.14.1"
authors = ["Sean Lawlor <slawlor>"]
description = "Distributed cluster environment of Ractor actors"
documentation = "https://docs.rs/ractor"
Expand Down
2 changes: 1 addition & 1 deletion ractor_cluster_derive/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ractor_cluster_derive"
version = "0.14.0"
version = "0.14.1"
authors = ["Sean Lawlor <slawlor>"]
description = "Derives for ractor_cluster"
license = "MIT"
Expand Down

0 comments on commit 6842be7

Please sign in to comment.