Kasper Juul Hermansen 61cbec0477
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing
chore(release): v0.3.0 (#4)
### Added
- add add_fn to execute immediate lambdas

Co-authored-by: cuddle-please <bot@cuddle.sh>
Reviewed-on: #4
2024-08-07 15:57:09 +02:00
2024-08-06 22:22:46 +02:00
2024-08-06 22:22:46 +02:00
2024-08-07 15:57:09 +02:00
2024-08-07 15:57:09 +02:00
2024-08-06 22:22:46 +02:00
2024-08-07 12:08:21 +02:00

MAD

Mad is a life-cycle manager for long running rust operations.

  • Webservers
  • Queue bindings
  • gRPC servers etc
  • Cron runners

It is supposed to be the main thing the application runs, and everything from it is spawned and managed by it.

struct WaitServer {}

#[async_trait]
impl Component for WaitServer {
    fn name(&self) -> Option<String> {
        Some("NeverEndingRun".into())
    }

    async fn run(&self, cancellation: CancellationToken) -> Result<(), mad::MadError> {
        let millis_wait = rand::thread_rng().gen_range(50..1000);

        // Simulates a server running for some time. Is normally supposed to be futures blocking indefinitely
        tokio::time::sleep(std::time::Duration::from_millis(millis_wait)).await;

        Ok(())
    }
}

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    Mad::builder()
        .add(WaitServer {})
        .add(WaitServer {})
        .add(WaitServer {})
        .run()
        .await?;

    Ok(())
}
Description
No description provided
Readme 148 KiB
v0.7.1 Latest
2024-11-24 11:28:15 +01:00
Languages
Rust 100%