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

Add some cleanups I've been carrying locally #117

Merged
merged 1 commit into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions docker/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ elif [[ $TOOL == "asan" ]]; then
elif [[ $TOOL == "miri" ]]; then
export RUSTFLAGS="$RUSTFLAGS -Zrandomize-layout -Cdebuginfo=1"
export MIRIFLAGS="-Zmiri-disable-isolation -Zmiri-ignore-leaks -Zmiri-num-cpus=64"
elif [[ $TOOL == "check" ]]; then
export RUSTFLAGS="$RUSTFLAGS -Zthreads=64"
fi
export RUSTDOCFLAGS=$RUSTFLAGS

Expand Down
3 changes: 2 additions & 1 deletion src/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const IGNORED_CRATES: &[&str] = &[
"stdweb",
"wayland-raw-protocol-bindings",
"pleingres",
"gdnative-bindings-lily",
];

#[derive(Parser, Clone)]
Expand Down Expand Up @@ -111,7 +112,7 @@ pub async fn run(args: Args) -> Result<()> {
let mut crates = build_crate_list(&args, &client).await?;
if !args.rerun {
let finished_crates = client
.list_finished_crates(Some(time::Duration::days(90)))
.list_finished_crates(Some(time::Duration::days(30)))
.await?;
crates.retain(|krate| {
!finished_crates
Expand Down
13 changes: 9 additions & 4 deletions src/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ pub async fn run(args: Args) -> Result<()> {
}

async fn sync_all_html(client: Arc<Client>) -> Result<Vec<Crate>> {
log::info!("Enumerating all finished crates");
let all = client.list_finished_crates(None).await?;
log::info!("Re-rendering HTML for {} crates", all.len());
let mut tasks = JoinSet::new();
Expand All @@ -103,7 +104,7 @@ async fn sync_all_html(client: Arc<Client>) -> Result<Vec<Crate>> {
Vec::new(),
5,
))));
for krate in all {
for krate in all.into_iter().rev() {
let limit = Arc::clone(&limit);
let client = Arc::clone(&client);
//let all_raw = Arc::clone(&all_raw);
Expand All @@ -124,7 +125,6 @@ async fn sync_all_html(client: Arc<Client>) -> Result<Vec<Crate>> {
}
*/

log::info!("Rendering {:?}", krate);
let rendered = render::render_crate(&krate, &raw);
/*
let mut header = tar::Header::new_gnu();
Expand All @@ -143,8 +143,13 @@ async fn sync_all_html(client: Arc<Client>) -> Result<Vec<Crate>> {
}
*/

let previous = client.download_html(&krate).await?;
if previous != rendered.as_bytes() {
let previous = client.download_html(&krate).await;
if let Ok(previous) = previous {
if previous != rendered.as_bytes() {
log::info!("Uploading {}@{}", krate.name, krate.version);
client.upload_html(&krate, rendered.into_bytes()).await?;
}
} else {
log::info!("Uploading {}@{}", krate.name, krate.version);
client.upload_html(&krate, rendered.into_bytes()).await?;
}
Expand Down