Unverified Commit 774579e5 authored by Tobias Koppers's avatar Tobias Koppers Committed by GitHub

[Turbopack] more debugging options for Persistent Cache (#73550)

### What?

* do no delete persistent cache when repo is dirty
* allow to specify a cache version with `TURBO_ENGINE_VERSION`
* add `TURBO_ENGINE_READ_ONLY` to switch to read only
parent 2bc1fde2
......@@ -129,7 +129,14 @@ pub fn create_turbo_tasks(
Ok(if persistent_caching {
NextTurboTasks::PersistentCaching(TurboTasks::new(
turbo_tasks_backend::TurboTasksBackend::new(
turbo_tasks_backend::BackendOptions::default(),
turbo_tasks_backend::BackendOptions {
storage_mode: Some(if std::env::var("TURBO_ENGINE_READ_ONLY").is_ok() {
turbo_tasks_backend::StorageMode::ReadOnly
} else {
turbo_tasks_backend::StorageMode::ReadWrite
}),
..Default::default()
},
default_backing_storage(&output_path.join("cache/turbopack"))?,
),
))
......
......@@ -13,6 +13,9 @@ use anyhow::Result;
const MAX_OTHER_DB_VERSIONS: usize = 2;
pub fn handle_db_versioning(base_path: &Path) -> Result<PathBuf> {
if let Ok(version) = env::var("TURBO_ENGINE_VERSION") {
return Ok(base_path.join(version));
}
// Database versioning. Pass `TURBO_ENGINE_IGNORE_DIRTY` at runtime to ignore a
// dirty git repository. Pass `TURBO_ENGINE_DISABLE_VERSIONING` at runtime to disable
// versioning and always use the same database.
......@@ -87,7 +90,6 @@ pub fn handle_db_versioning(base_path: &Path) -> Result<PathBuf> {
}
}
} else {
let _ = remove_dir_all(base_path);
path = base_path.join("temp");
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment