Skip to content

Commit 49b4252

Browse files
nikomatsakisNiko Matsakis
andauthored
remove github caches (#301)
* remove github caches * do not persist github data on disk * triagebot is special * don't need this dep anymore * ignore triagebot properly * whoops... * say 'available' --------- Co-authored-by: Niko Matsakis <nikomat@amazon.com>
1 parent 529b898 commit 49b4252

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+32
-74
lines changed

Cargo.lock

Lines changed: 0 additions & 54 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

book.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ command = "cargo run -p mdbook-goals --"
2323
[preprocessor.goals.users]
2424
"@Nadrieril" = "@Nadrieril"
2525

26+
preprocessor.goals.ignore_users = [
27+
"@triagebot",
28+
]
29+
2630

2731
[output.html]
2832
git-repository-url = "https://github.com/rust-lang/rust-project-goals"

crates/mdbook-goals/src/mdbook_preprocessor.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ use rust_project_goals::{
2020
const LINKS: &str = "links";
2121
const LINKIFIERS: &str = "linkifiers";
2222
const USERS: &str = "users";
23+
const IGNORE_USERS: &str = "ignore_users";
2324

2425
pub struct GoalPreprocessor;
2526

@@ -45,6 +46,7 @@ pub struct GoalPreprocessorWithContext<'c> {
4546
links: Vec<(String, String)>,
4647
linkifiers: Vec<(Regex, String)>,
4748
display_names: BTreeMap<String, Rc<String>>,
49+
ignore_users: Vec<String>,
4850
goal_document_map: BTreeMap<PathBuf, Arc<Vec<GoalDocument>>>,
4951
}
5052

@@ -55,6 +57,7 @@ impl<'c> GoalPreprocessorWithContext<'c> {
5557
let mut links: Vec<(String, String)> = Default::default();
5658
let mut linkifiers = Default::default();
5759
let mut display_names: BTreeMap<String, Rc<String>> = Default::default();
60+
let mut ignore_users: Vec<String> = Default::default();
5861
if let Some(config) = ctx.config.get_preprocessor(GoalPreprocessor.name()) {
5962
if let Some(value) = config.get(LINKS) {
6063
links = value
@@ -112,6 +115,24 @@ impl<'c> GoalPreprocessorWithContext<'c> {
112115
display_names.insert(user, Rc::new(display_name));
113116
}
114117
}
118+
119+
if let Some(value) = config.get(IGNORE_USERS) {
120+
ignore_users = value
121+
.as_array()
122+
.with_context(|| format!("`{}` must be an array", IGNORE_USERS))?
123+
.iter()
124+
.map(|v| {
125+
if let Some(v) = v.as_str() {
126+
Ok(v.to_string())
127+
} else {
128+
Err(anyhow::anyhow!(
129+
"ignore user value `{}` must be a string",
130+
v
131+
))
132+
}
133+
})
134+
.collect::<anyhow::Result<Vec<_>>>()?;
135+
}
115136
}
116137

117138
Ok(GoalPreprocessorWithContext {
@@ -122,6 +143,7 @@ impl<'c> GoalPreprocessorWithContext<'c> {
122143
links,
123144
linkifiers,
124145
display_names,
146+
ignore_users,
125147
goal_document_map: Default::default(),
126148
})
127149
}
@@ -312,6 +334,7 @@ impl<'c> GoalPreprocessorWithContext<'c> {
312334
.username
313335
.find_iter(&chapter.content)
314336
.map(|m| m.as_str().to_string())
337+
.filter(|username| !self.ignore_users.contains(username))
315338
.collect();
316339

317340
for username in &usernames {

crates/rust-project-goals-cli-llm/src/updates.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,9 @@ async fn prepare_goals(
123123
let why_this_goal = why_this_goal(&issue_id, issue)?;
124124

125125
let details_summary = match comments.len() {
126-
0 => String::from("No updates posted."),
127-
1 => String::from("1 update posted."),
128-
len => format!("{len} updates posted."),
126+
0 => String::from("No detailed updates available."),
127+
1 => String::from("1 detailed update available."),
128+
len => format!("{len} detailed updates availabled."),
129129
};
130130
result.push(UpdatesGoal {
131131
title: title.clone(),

crates/rust-project-goals/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ edition = "2021"
66
[dependencies]
77
anyhow = "1.0.94"
88
chrono = "0.4.39"
9-
disk-persist = "0.1.0"
109
lazy_static = "1.5.0"
1110
regex = "1.11.1"
1211
reqwest = { version = "0.12.9", features = ["blocking", "json"] }

crates/rust-project-goals/src/util.rs

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ use std::{
44
path::{Path, PathBuf},
55
};
66

7-
use disk_persist::DiskPersist;
87
use walkdir::WalkDir;
98

109
pub const ARROW: &str = "↳";
@@ -59,20 +58,7 @@ pub struct GithubUserInfo {
5958

6059
impl GithubUserInfo {
6160
pub fn load(login: &str) -> anyhow::Result<Self> {
62-
let path = PathBuf::from("gh-cache").join(format!("{}.bincode", login));
63-
let persist = DiskPersist::init_with_path(&path)?;
64-
if let Some(info) = persist.read()? {
65-
Ok(info)
66-
} else {
67-
let info = Self::github_request(login)?;
68-
persist.write(&info)?;
69-
eprintln!(
70-
"cached info for `{}` from github in `{}`",
71-
login,
72-
path.display()
73-
);
74-
Ok(info)
75-
}
61+
Self::github_request(login)
7662
}
7763

7864
fn github_request(login: &str) -> anyhow::Result<Self> {

gh-cache/@1c3t3a.bincode

-25 Bytes
Binary file not shown.

gh-cache/@BoxyUwU.bincode

-13 Bytes
Binary file not shown.

gh-cache/@Darksonn.bincode

-19 Bytes
Binary file not shown.

gh-cache/@Deleted.bincode

-20 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)