Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: short circuit on no-op #962

Merged
merged 1 commit into from
Nov 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions crates/rattler_repodata_gateway/src/gateway/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,11 @@ impl RepoDataQuery {

/// Execute the query and return the resulting repodata records.
pub async fn execute(self) -> Result<Vec<RepoData>, GatewayError> {
// Short circuit if there are no specs
if self.specs.is_empty() {
return Ok(Vec::default());
}

// Collect all the channels and platforms together
let channels_and_platforms = self
.channels
Expand Down Expand Up @@ -127,6 +132,11 @@ impl RepoDataQuery {
}
}

// Short circuit if there are no channels or platforms specified
if direct_url_specs.is_empty() && channels_and_platforms.is_empty() {
return Ok(Vec::default());
}

// Result offset for direct url queries.
let direct_url_offset = usize::from(!direct_url_specs.is_empty());

Expand Down