Skip to content

Commit 5b2f3a3

Browse files
author
Niko Matsakis
committed
avoid reloading every issue from github
1 parent 8132a52 commit 5b2f3a3

File tree

1 file changed

+9
-3
lines changed
  • crates/rust-project-goals-cli/src

1 file changed

+9
-3
lines changed

crates/rust-project-goals-cli/src/rfc.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -295,8 +295,14 @@ fn initialize_issues<'doc>(
295295
//
296296
let existing_issue = if let Some(tracking_issue) = desired_issue.tracking_issue {
297297
// a. We first check if there is a declared tracking issue in the markdown file.
298-
// If so, then we just load its information from the repository by number.
299-
Some(fetch_issue(repository, tracking_issue.number)?)
298+
// If so, check if we've already loaded its data.
299+
if let Some(issue) = milestone_issues.iter().find(|issue| issue.number == tracking_issue.number) {
300+
// If so, reuse it to avoid latency.
301+
Some(issue.clone())
302+
} else {
303+
// If not, load its information from the repository by number.
304+
Some(fetch_issue(repository, tracking_issue.number)?)
305+
}
300306
} else {
301307
// b. If the markdown does not have a declared tracking issue, then we can search through
302308
// the issues in the milestone for one with the correct title.
@@ -357,7 +363,7 @@ fn initialize_issues<'doc>(
357363
if !existing_issue.body.contains(&link_text) {
358364
actions.insert(GithubAction::UpdateIssueBody {
359365
number: existing_issue.number,
360-
body: existing_issue.body,
366+
body: desired_issue.body,
361367
});
362368
}
363369

0 commit comments

Comments
 (0)