riker-rs / riker

Easily build efficient, highly concurrent and resilient applications. An Actor Framework for Rust.
https://riker.rs
MIT License
1.01k stars 71 forks source link

`Running Futures` example is invalid #169

Closed berkus closed 9 months ago

berkus commented 2 years ago

As displayed in the example code:

let handle = system.run(async move {
    "someval".to_string()
});

assert_eq!(block_on(handle), "someval".to_string());

This will not even build because run() returns Result and block_on() expects a non-Result argument.

berkus commented 2 years ago

If you try to unwrap() and run block_on(handle.unwrap()) then riker will crash with:

thread 'pool-thread-#0' panicked at 'cannot execute LocalPool executor from within another executor: EnterError', stack backtrace: thread 'pool-thread-#4' panicked at 'there is no reactor running, must be called from the context of a Tokio 1.x runtime'

knepe commented 9 months ago

Any news on this? I'm having the exact same issue

hardliner66 commented 9 months ago

@knepe the riker project is abandoned. The original maintainer vanished without saying anything. It's probably better to migrate towards a different actor framework.

For the problem itself: block_on must be called from a tokio context. That means, you need to run your app as a tokio app and run block_on from there.

knepe commented 9 months ago

Ah damn :( Thanks!

berkus commented 9 months ago

@knepe https://github.com/slawlor/ractor perhaps :)