Skip to content

Commit

Permalink
Add some cleanups I've been carrying locally (#117)
Browse files Browse the repository at this point in the history
  • Loading branch information
saethlin authored Oct 8, 2024
1 parent 2a0dc18 commit f014c7d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
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

0 comments on commit f014c7d

Please sign in to comment.