elfo-rs / elfo

An asynchronous distributed actor framework in Rust with robust observability
217 stars 12 forks source link

Panic at config deserialization on startup makes elfo stuck #125

Closed Arjentix closed 3 months ago

Arjentix commented 4 months ago

Example:

use elfo::{batteries, Topology};

#[tokio::main]
async fn main() {
    let topology = Topology::empty();

    let configurers = topology.local("system.configurers").entrypoint();
    configurers.mount(batteries::configurer::from_path(&topology, "config.toml"));

    let stub_group = topology.local("stub");
    stub_group.mount(stub::new());

    elfo::init::start(topology).await;
}

mod stub {
    use elfo::{ActorGroup, Blueprint};

    pub fn new() -> Blueprint {
        ActorGroup::new().config::<Config>().exec(|_ctx| async {
            println!("Stub");
        })
    }

    #[derive(Debug)]
    struct Config;

    impl<'de> serde::de::Deserialize<'de> for Config {
        fn deserialize<D>(_deserializer: D) -> Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            println!("Deserializing");
            unimplemented!()
        }
    }
}

See full example here: https://github.com/Arjentix/elfo-bug