Skip to content
Snippets Groups Projects

gitlab-ci: Cope with OBS slowdown

Merged Emanuele Aina requested to merge wip/em/cope-with-slower-obs into master
2 files
+ 61
21
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -88,22 +88,31 @@ async fn read_deb822_file<
download: F,
client: &'client Client,
url: &'url str,
) -> Result<T> {
let bytes = download(client, url)
.await
.with_context(|| format!("Failed to download {}", url))?;
let file = tokio::task::block_in_place(|| {
rfc822_like::from_bytes(&bytes[..])
.with_context(|| format!("Failed to parse {}", url))
})?;
) -> Result<Option<T>> {
match lift_404(
download(client, url)
.await
.with_context(|| format!("Failed to download {}", url)),
)? {
Some(bytes) => {
let file = tokio::task::block_in_place(|| {
rfc822_like::from_bytes(&bytes[..])
.with_context(|| format!("Failed to parse {}", url))
})?;
debug!("Retrieved repo file");
Ok(Some(file))
}
debug!("Retrieved repo file");
Ok(file)
None => Ok(None),
}
}
impl Repository {
pub async fn read_release(&self, client: &Client) -> Result<RepositoryRelease> {
pub async fn read_release(
&self,
client: &Client,
) -> Result<Option<RepositoryRelease>> {
read_deb822_file(Client::get, client, &format!("{}/Release", &self.url)).await
}
@@ -111,7 +120,7 @@ impl Repository {
&self,
client: &Client,
component: &str,
) -> Result<Vec<SourcePackage>> {
) -> Result<Option<Vec<SourcePackage>>> {
read_deb822_file(
get_maybe_compressed_file,
client,
@@ -125,7 +134,7 @@ impl Repository {
client: &Client,
component: &str,
arch: &str,
) -> Result<Vec<BinaryPackage>> {
) -> Result<Option<Vec<BinaryPackage>>> {
read_deb822_file(
get_maybe_compressed_file,
client,
Loading