Skip to content

Commit

Permalink
dev(cli): correctly evict compilation cache
Browse files Browse the repository at this point in the history
  • Loading branch information
Myriad-Dreamin committed Aug 27, 2023
1 parent 140d0bf commit 149446a
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ handlebars = "4.3"

# general
anyhow = "1"
comemo = "0.3"
tokio = { version = "1.28.1", features = ["full"] }

# cryptography and processing
Expand Down
2 changes: 1 addition & 1 deletion cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ clap.workspace = true
clap_complete.workspace = true
clap_complete_fig.workspace = true

# comemo.workspace = true
comemo.workspace = true
# chrono.workspace = true
tokio.workspace = true
include_dir.workspace = true
Expand Down
3 changes: 3 additions & 0 deletions cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,9 @@ pub async fn serve(args: ServeArgs) -> ZResult<()> {
// Build the book if it hasn't been built yet
if !args.no_build {
proj.build()?;

// since we don't need the compilation cache anymore, we can evict it
comemo::evict(0);
}

let http_addr: SocketAddr = args
Expand Down
3 changes: 3 additions & 0 deletions cli/src/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,9 @@ impl Project {
write_file(&self.dest_dir.join("index.html"), content)?;
write_index = true;
}

// cleanup cache
comemo::evict(5);
}
}

Expand Down

0 comments on commit 149446a

Please sign in to comment.