mirror of
https://github.com/denoland/deno.git
synced 2024-12-26 17:19:06 -05:00
parent
8f7787f81b
commit
45fad6a622
1 changed files with 11 additions and 2 deletions
|
@ -42,7 +42,11 @@ impl DenoCompileCodeCache {
|
||||||
// attempt to deserialize the cache data
|
// attempt to deserialize the cache data
|
||||||
match deserialize(&file_path, cache_key) {
|
match deserialize(&file_path, cache_key) {
|
||||||
Ok(data) => {
|
Ok(data) => {
|
||||||
log::debug!("Loaded {} code cache entries", data.len());
|
log::debug!(
|
||||||
|
"Loaded {} code cache entries from {}",
|
||||||
|
data.len(),
|
||||||
|
file_path.display()
|
||||||
|
);
|
||||||
Self {
|
Self {
|
||||||
strategy: CodeCacheStrategy::SubsequentRun(
|
strategy: CodeCacheStrategy::SubsequentRun(
|
||||||
SubsequentRunCodeCacheStrategy {
|
SubsequentRunCodeCacheStrategy {
|
||||||
|
@ -53,7 +57,11 @@ impl DenoCompileCodeCache {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
log::debug!("Failed to deserialize code cache: {:#}", err);
|
log::debug!(
|
||||||
|
"Failed to deserialize code cache from {}: {:#}",
|
||||||
|
file_path.display(),
|
||||||
|
err
|
||||||
|
);
|
||||||
Self {
|
Self {
|
||||||
strategy: CodeCacheStrategy::FirstRun(FirstRunCodeCacheStrategy {
|
strategy: CodeCacheStrategy::FirstRun(FirstRunCodeCacheStrategy {
|
||||||
cache_key,
|
cache_key,
|
||||||
|
@ -186,6 +194,7 @@ impl FirstRunCodeCacheStrategy {
|
||||||
Ok(()) => {
|
Ok(()) => {
|
||||||
if let Err(err) = std::fs::rename(&temp_file, &self.file_path) {
|
if let Err(err) = std::fs::rename(&temp_file, &self.file_path) {
|
||||||
log::debug!("Failed to rename code cache: {}", err);
|
log::debug!("Failed to rename code cache: {}", err);
|
||||||
|
let _ = std::fs::remove_file(&temp_file);
|
||||||
} else {
|
} else {
|
||||||
log::debug!("Serialized {} code cache entries", count);
|
log::debug!("Serialized {} code cache entries", count);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue