Merge pull request #168 from NobodyXu/feature/avoid-oom

This commit is contained in:
Félix Saparelli 2022-06-10 01:55:22 +12:00 committed by GitHub
commit 29b28a4f8f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 517 additions and 146 deletions

View file

@ -7,7 +7,7 @@ use tokio::task::JoinHandle;
use url::Url;
use super::Data;
use crate::{download, remote_exists, BinstallError, PkgFmt};
use crate::{download_and_extract, remote_exists, BinstallError, PkgFmt};
const BASE_URL: &str = "https://github.com/alsuren/cargo-quickinstall/releases/download";
const STATS_URL: &str = "https://warehouse-clerk-tmp.vercel.app/api/crate";
@ -37,10 +37,10 @@ impl super::Fetcher for QuickInstall {
remote_exists(Url::parse(&url)?, Method::HEAD).await
}
async fn fetch(&self, dst: &Path) -> Result<(), BinstallError> {
async fn fetch_and_extract(&self, dst: &Path) -> Result<(), BinstallError> {
let url = self.package_url();
info!("Downloading package from: '{url}'");
download(&url, &dst).await
download_and_extract::<_, 0>(Url::parse(&url)?, self.pkg_fmt(), dst, None).await
}
fn pkg_fmt(&self) -> PkgFmt {