From 2847bdc69e1983d891687038c785a36022e781d2 Mon Sep 17 00:00:00 2001 From: Astro Date: Mon, 24 Apr 2023 19:35:19 +0200 Subject: [PATCH] hunter: try out tokio-uring --- Cargo.lock | 31 +++++++++++++++++++++++++++++++ hunter/Cargo.toml | 1 + hunter/src/main.rs | 10 ++++++++-- 3 files changed, 40 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 76d3eca..1e5dc48 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -355,6 +355,7 @@ dependencies = [ "serde", "texting_robots", "tokio", + "tokio-uring", "tracing", ] @@ -1004,6 +1005,16 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "io-uring" +version = "0.5.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd1e1a01cfb924fd8c5c43b6827965db394f5a3a16c599ce03452266e1cf984c" +dependencies = [ + "bitflags", + "libc", +] + [[package]] name = "ipconfig" version = "0.3.1" @@ -1746,6 +1757,12 @@ dependencies = [ "windows-sys 0.42.0", ] +[[package]] +name = "scoped-tls" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" + [[package]] name = "scopeguard" version = "1.1.0" @@ -2069,6 +2086,20 @@ dependencies = [ "tokio", ] +[[package]] +name = "tokio-uring" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d5e02bb137e030b3a547c65a3bd2f1836d66a97369fdcc69034002b10e155ef" +dependencies = [ + "io-uring", + "libc", + "scoped-tls", + "slab", + "socket2", + "tokio", +] + [[package]] name = "tokio-util" version = "0.7.7" diff --git a/hunter/Cargo.toml b/hunter/Cargo.toml index efc03ef..432d948 100644 --- a/hunter/Cargo.toml +++ b/hunter/Cargo.toml @@ -6,6 +6,7 @@ edition = "2021" [dependencies] futures = "0.3" tokio = { version = "1", features = ["full", "tracing"] } +tokio-uring = "0.4" reqwest = { version = "0.11", features = ["json", "deflate", "gzip", "trust-dns"] } serde = { version = "1", features = ["derive"] } # serde_yaml = "0.9" diff --git a/hunter/src/main.rs b/hunter/src/main.rs index c48ac2c..c66e459 100644 --- a/hunter/src/main.rs +++ b/hunter/src/main.rs @@ -17,8 +17,14 @@ use worker::Message; #[global_allocator] static GLOBAL: jemallocator::Jemalloc = jemallocator::Jemalloc; -#[tokio::main] -async fn main() { +fn main() -> Result<(), Box> { + tokio_uring::start(async { + run().await; + Ok(()) + }) +} + +async fn run() { cave::systemd::extend_timeout(100_000); cave::init::exit_on_panic();