bastion-rs / fort

Proc macro attributes for Bastion runtime.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Macro based on retries

vertexclique opened this issue · comments

The macro should enable how many times a process can be restarted.

#[fort::root(max_retries=4)]
fn main {
    panic!("Killed");
}

Process output

Killed
Killed
Killed
Killed

I will take this issue. @vertexclique

commented

what's going on with this?

@imkow This feature went inside with Bastion itself:
https://docs.rs/bastion/0.3.4/bastion/supervisor/struct.RestartStrategy.html

    /// #     use std::time::Duration;
    /// #     let actor_restart_strategy = ActorRestartStrategy::LinearBackOff {
    /// #         timeout: Duration::from_secs(5)
    /// #     };
    /// #     let restart_strategy = RestartStrategy::default()
    /// #        .with_actor_restart_strategy(actor_restart_strategy);

We will add this to fort asap. RestartStrategy::Tries is what you want to use.