diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 8ef12e0d6d..7643142e97 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -63,6 +63,12 @@ jobs: - name: Setup environment variables run: | echo "RUSTFLAGS=--remap-path-prefix=${GITHUB_WORKSPACE}=/builds/dfinity" >> $GITHUB_ENV + # Remove pre-installed stable toolchain so it doesn't pollute the + # rust-cache environment hash. macOS (and sometimes Linux) runner + # images ship with varying stable versions, making the hash + # non-deterministic and causing constant cache misses. + - name: Remove pre-installed Rust stable toolchain + run: rustup toolchain remove stable 2>/dev/null || true # This step also handles Rust-specific caching - name: Install Rust toolchain uses: actions-rust-lang/setup-rust-toolchain@v1 diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 8d67427e5f..2a8e79b2f2 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -47,7 +47,12 @@ jobs: steps: - uses: actions/checkout@v6 - + # Remove pre-installed stable toolchain so it doesn't pollute the + # rust-cache environment hash. macOS (and sometimes Linux) runner + # images ship with varying stable versions, making the hash + # non-deterministic and causing constant cache misses. + - name: Remove pre-installed Rust stable toolchain + run: rustup toolchain remove stable 2>/dev/null || true # This step also handles Rust-specific caching - name: Install Rust toolchain uses: actions-rust-lang/setup-rust-toolchain@v1 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1546d09b5d..4390c4c79f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -66,6 +66,13 @@ jobs: echo "TARBALL_2_FILENAME=dfx-${{ matrix.target }}.tar.gz" >> $GITHUB_ENV echo "SHA256_2_FILENAME=dfx-${{ matrix.target }}.tar.gz.sha256" >> $GITHUB_ENV + # Remove pre-installed stable toolchain so it doesn't pollute the + # rust-cache environment hash. macOS (and sometimes Linux) runner + # images ship with varying stable versions, making the hash + # non-deterministic and causing constant cache misses. + - name: Remove pre-installed Rust stable toolchain + run: rustup toolchain remove stable 2>/dev/null || true + # This step also handles Rust-specific caching - name: Install Rust toolchain uses: actions-rust-lang/setup-rust-toolchain@v1 diff --git a/.github/workflows/unit.yml b/.github/workflows/unit.yml index 0cf2bdacde..66b9ed600f 100644 --- a/.github/workflows/unit.yml +++ b/.github/workflows/unit.yml @@ -48,6 +48,12 @@ jobs: os: [ ubuntu-24.04, ubuntu-24.04-arm, macos-15 ] steps: - uses: actions/checkout@v6 + # Remove pre-installed stable toolchain so it doesn't pollute the + # rust-cache environment hash. macOS (and sometimes Linux) runner + # images ship with varying stable versions, making the hash + # non-deterministic and causing constant cache misses. + - name: Remove pre-installed Rust stable toolchain + run: rustup toolchain remove stable 2>/dev/null || true # This step also handles Rust-specific caching - name: Install Rust toolchain uses: actions-rust-lang/setup-rust-toolchain@v1 diff --git a/src/canisters/frontend/icx-asset/src/main.rs b/src/canisters/frontend/icx-asset/src/main.rs index 5ee18114ec..dc657d5249 100644 --- a/src/canisters/frontend/icx-asset/src/main.rs +++ b/src/canisters/frontend/icx-asset/src/main.rs @@ -136,7 +136,7 @@ fn style() -> Styles { async fn main() -> anyhow::Result<()> { let opts: Opts = Opts::parse(); - let logger = support::new_logger(opts.log_level.into()); + let (logger, _async_guard) = support::new_logger(opts.log_level.into()); let agent = Agent::builder() .with_url(&opts.replica) diff --git a/src/canisters/frontend/icx-asset/src/support.rs b/src/canisters/frontend/icx-asset/src/support.rs index 0cf5c897c7..69c34ba560 100644 --- a/src/canisters/frontend/icx-asset/src/support.rs +++ b/src/canisters/frontend/icx-asset/src/support.rs @@ -42,10 +42,13 @@ impl slog::Drain for TermLogFormat { } } -pub(crate) fn new_logger(level: Level) -> Logger { +pub(crate) fn new_logger(level: Level) -> (Logger, slog_async::AsyncGuard) { let decorator = slog_term::TermDecorator::new().build(); let drain = TermLogFormat::new(decorator).fuse(); let drain = slog::LevelFilter::new(drain, level).fuse(); - let drain = slog_async::Async::new(drain).build().fuse(); - Logger::root(drain, slog::o!()) + let (drain, guard) = slog_async::Async::new(drain) + .overflow_strategy(slog_async::OverflowStrategy::Block) + .build_with_guard(); + let drain = drain.fuse(); + (Logger::root(drain, slog::o!()), guard) }