From f9513a38281082310e7d1192bcdfc7c0e64cc9a1 Mon Sep 17 00:00:00 2001 From: monosans Date: Tue, 30 Sep 2025 15:01:28 +0300 Subject: [PATCH] fix: default to tokio current_thread flavor & system allocator --- .github/workflows/ci.yml | 4 ++-- Cargo.toml | 1 + Dockerfile | 2 +- src/main.rs | 6 +++++- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4ea1fb3..321a853 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -246,9 +246,9 @@ jobs: env: RUSTFLAGS: "" - if: ${{ matrix.cross }} - run: cross +beta build --features mimalloc_v3,tui --release --target '${{ matrix.target }}' --locked + run: cross +beta build --features tokio-current-thread,tui --release --target '${{ matrix.target }}' --locked - if: ${{ !matrix.cross }} - run: cargo +beta build --features mimalloc_v3,tui --release --target '${{ matrix.target }}' --locked + run: cargo +beta build --features tokio-current-thread,tui --release --target '${{ matrix.target }}' --locked - run: mkdir dist - run: echo -n '${{ github.sha }}' > dist/commit-sha.txt shell: bash diff --git a/Cargo.toml b/Cargo.toml index bcc2fbd..675f90e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -66,6 +66,7 @@ dhat = ["dep:dhat"] jemalloc = ["dep:tikv-jemallocator"] mimalloc_v2 = ["dep:mimalloc_v2"] mimalloc_v3 = ["dep:mimalloc_v3"] +tokio-current-thread = [] tui = ["dep:crossterm", "dep:futures", "dep:ratatui", "dep:tui-logger"] [profile.release] diff --git a/Dockerfile b/Dockerfile index 2cd2905..a8f57ae 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,7 +9,7 @@ RUN --mount=source=src,target=src \ --mount=source=Cargo.lock,target=Cargo.lock \ --mount=type=cache,target=/app/target,sharing=locked \ --mount=type=cache,target=/usr/local/cargo/registry,sharing=locked \ - cargo build --features mimalloc_v3 --release --locked \ + cargo build --features tokio-current-thread --release --locked \ && cp target/release/proxy-scraper-checker . diff --git a/src/main.rs b/src/main.rs index 9f4caa3..ddffd3f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -318,7 +318,11 @@ async fn run_without_tui( main_task(config, token).await } -#[tokio::main] +#[cfg_attr( + feature = "tokio-current-thread", + tokio::main(flavor = "current_thread") +)] +#[cfg_attr(not(feature = "tokio-current-thread"), tokio::main)] #[expect(clippy::unwrap_in_result)] async fn main() -> crate::Result<()> { #[cfg(feature = "dhat")]