diff --git a/Containerfile b/Containerfile index 512910763..a8ab1bb76 100644 --- a/Containerfile +++ b/Containerfile @@ -6,7 +6,7 @@ FROM docker.io/library/rust:trixie AS chef WORKDIR /tmp RUN curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash -RUN cargo binstall --no-confirm cargo-chef cargo-nextest +RUN cargo binstall --no-confirm --locked cargo-chef cargo-nextest ## Tester Image FROM docker.io/library/rust:slim-trixie AS tester @@ -16,7 +16,7 @@ RUN apt-get update \ && apt-get install -y curl sqlite3 time \ && apt-get autoclean RUN curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash -RUN cargo binstall --no-confirm cargo-nextest +RUN cargo binstall --no-confirm --locked cargo-nextest # Database initialization: Tests at runtime require a pre-initialized SQLite3 database # to test against a valid (not corrupted) schema. The VACUUM command optimizes the # database file layout. This image layer is inherited by test_debug and test stages. diff --git a/packages/torrent-repository-benchmarking/src/repository/rw_lock_std_mutex_tokio.rs b/packages/torrent-repository-benchmarking/src/repository/rw_lock_std_mutex_tokio.rs index 3c5663729..b085cff7c 100644 --- a/packages/torrent-repository-benchmarking/src/repository/rw_lock_std_mutex_tokio.rs +++ b/packages/torrent-repository-benchmarking/src/repository/rw_lock_std_mutex_tokio.rs @@ -67,15 +67,14 @@ where } } - async fn get(&self, key: &InfoHash) -> Option { + fn get(&self, key: &InfoHash) -> impl Future> + Send { let db = self.get_torrents(); - db.get(key).cloned() + std::future::ready(db.get(key).cloned()) } - async fn get_paginated(&self, pagination: Option<&Pagination>) -> Vec<(InfoHash, EntryMutexTokio)> { + fn get_paginated(&self, pagination: Option<&Pagination>) -> impl Future> + Send { let db = self.get_torrents(); - - match pagination { + std::future::ready(match pagination { Some(pagination) => db .iter() .skip(pagination.offset as usize) @@ -83,7 +82,7 @@ where .map(|(a, b)| (*a, b.clone())) .collect(), None => db.iter().map(|(a, b)| (*a, b.clone())).collect(), - } + }) } async fn get_metrics(&self) -> AggregateActiveSwarmMetadata { @@ -102,7 +101,7 @@ where metrics } - async fn import_persistent(&self, persistent_torrents: &NumberOfDownloadsBTreeMap) { + fn import_persistent(&self, persistent_torrents: &NumberOfDownloadsBTreeMap) -> impl Future + Send { let mut db = self.get_torrents_mut(); for (info_hash, completed) in persistent_torrents { @@ -121,11 +120,13 @@ where db.insert(*info_hash, entry); } + + std::future::ready(()) } - async fn remove(&self, key: &InfoHash) -> Option { + fn remove(&self, key: &InfoHash) -> impl Future> + Send { let mut db = self.get_torrents_mut(); - db.remove(key) + std::future::ready(db.remove(key)) } async fn remove_inactive_peers(&self, current_cutoff: DurationSinceUnixEpoch) {