Skip to content

Commit

Permalink
fix(backend-api): Remove useless sanity checks
Browse files Browse the repository at this point in the history
  • Loading branch information
xdoardo committed Jul 16, 2024
1 parent 1135597 commit e1b8201
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions lib/backend-api/src/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ pub async fn get_all_app_secrets_filtered(
names: Some(names.into_iter().map(|s| s.into()).collect()),
};

let mut all_versions = Vec::<Secret>::new();
let mut all_secrets = Vec::<Secret>::new();

loop {
let page = get_app_secrets(client, vars.clone()).await?;
Expand All @@ -119,17 +119,14 @@ pub async fn get_all_app_secrets_filtered(
None => continue,
};

// Sanity check to avoid duplication.
if all_versions.iter().any(|v| v.id == version.id) == false {
all_versions.push(version);
}
all_secrets.push(version);

// Update pagination.
vars.after = Some(edge.cursor);
}
}

Ok(all_versions)
Ok(all_secrets)
}

/// Load all secrets of an app.
Expand All @@ -149,7 +146,7 @@ pub async fn get_all_app_secrets(
names: None,
};

let mut all_versions = Vec::<Secret>::new();
let mut all_secrets = Vec::<Secret>::new();

loop {
let page = get_app_secrets(client, vars.clone()).await?;
Expand All @@ -167,17 +164,14 @@ pub async fn get_all_app_secrets(
None => continue,
};

// Sanity check to avoid duplication.
if all_versions.iter().any(|v| v.id == version.id) == false {
all_versions.push(version);
}
all_secrets.push(version);

// Update pagination.
vars.after = Some(edge.cursor);
}
}

Ok(all_versions)
Ok(all_secrets)
}

/// Retrieve secrets for an app.
Expand Down

0 comments on commit e1b8201

Please sign in to comment.