Skip to content

Commit

Permalink
Check old version, hopefully CI fails
Browse files Browse the repository at this point in the history
  • Loading branch information
Jake-Shadle committed Feb 7, 2024
1 parent b969d1e commit c0c8998
Showing 1 changed file with 5 additions and 49 deletions.
54 changes: 5 additions & 49 deletions src/index/sparse_remote.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,23 +74,12 @@ impl RemoteSparseIndex {
#[inline]
pub fn krates(
&self,
mut krates: BTreeSet<String>,
krates: BTreeSet<String>,
write_cache_entries: bool,
lock: &FileLock,
) -> BTreeMap<String, Result<Option<IndexKrate>, Error>> {
let Some(prep_krate) = krates.pop_last() else {
return Default::default();
};

let prep = || {
let name = prep_krate.as_str().try_into()?;
self.krate(name, write_cache_entries, lock)
};

let prep_krate_res = prep();

use rayon::prelude::*;
let mut results: BTreeMap<_, _> = krates
krates
.into_par_iter()
.map(|kname| {
let res = || {
Expand All @@ -100,10 +89,7 @@ impl RemoteSparseIndex {
let res = res();
(kname, res)
})
.collect();

results.insert(prep_krate, prep_krate_res);
results
.collect()
}
}

Expand Down Expand Up @@ -198,44 +184,14 @@ impl AsyncRemoteSparseIndex {
/// via something like [`tokio::time::timeout`](https://docs.rs/tokio/latest/tokio/time/fn.timeout.html)
pub async fn krates(
&self,
mut krates: BTreeSet<String>,
krates: BTreeSet<String>,
write_cache_entries: bool,
individual_timeout: Option<std::time::Duration>,
lock: &FileLock,
) -> BTreeMap<String, Result<Option<IndexKrate>, Error>> {
let Some(prep_krate) = krates.pop_last() else {
return Default::default();
};

let create_req = |kname: &str| -> Result<http::Request<&'static [u8]>, Error> {
let name = kname.try_into()?;
self.index.make_remote_request(name, None, lock)
};

let mut results = BTreeMap::new();

{
let result;
match create_req(&prep_krate).and_then(|req| Ok(req.try_into()?)) {
Ok(req) => match Self::exec_request(&self.client, req).await {
Ok(res) => {
result = self.index.parse_remote_response(
prep_krate.as_str().try_into().unwrap(),
res,
write_cache_entries,
lock,
);
}
Err(err) => result = Err(err),
},
Err(err) => result = Err(err),
}

results.insert(prep_krate, result);
}

let mut tasks = tokio::task::JoinSet::new();

let mut results = BTreeMap::new();
for kname in krates {
match kname.as_str().try_into().and_then(|name| {
Ok(self
Expand Down

0 comments on commit c0c8998

Please sign in to comment.