Only activate direct mode by default for local

45386750a4 reverted my initial change.

This re-enables direct mode by default, making sure only the disk
cache is affected. There may still be an issue with Windows, but
details are sparse and no reproduction has been found yet.
This commit is contained in:
Raphaël Gomès 2023-11-20 15:42:49 +01:00 коммит произвёл Sylvestre Ledru
Родитель 240c38f4df
Коммит aa20391f22
3 изменённых файлов: 14 добавлений и 4 удалений

Просмотреть файл

@ -30,7 +30,7 @@ Preprocessor cache mode will be disabled if any of the following holds:
Configuration options and their default values:
- `use_preprocessor_cache_mode`: `false`. Whether to use preprocessor cache mode entirely.
- `use_preprocessor_cache_mode`: `true`. Whether to use preprocessor cache mode entirely.
- `file_stat_matches`: `false`. If false, only compare header files by hashing their contents. If true, will use size + ctime + mtime to check whether a file has changed. See other flags below for more control over this behavior.
- `use_ctime_for_stat`: `true`. If true, uses the ctime (file status change on UNIX, creation time on Windows) to check that a file has/hasn't changed. Can be useful to disable when backdating modification times in a controlled manner.

12
src/cache/cache.rs поставляемый
Просмотреть файл

@ -366,7 +366,7 @@ pub trait Storage: Send + Sync {
/// Return the config for preprocessor cache mode if applicable
fn preprocessor_cache_mode_config(&self) -> PreprocessorCacheModeConfig {
// Disabled by default, only enabled in local mode
// Enable by default, only in local mode
PreprocessorCacheModeConfig::default()
}
/// Return the preprocessor cache entry for a given preprocessor key,
@ -431,6 +431,16 @@ impl Default for PreprocessorCacheModeConfig {
}
}
impl PreprocessorCacheModeConfig {
/// Return a default [`Self`], but with the cache active.
pub fn activated() -> Self {
Self {
use_preprocessor_cache_mode: true,
..Default::default()
}
}
}
/// Implement storage for operator.
#[cfg(any(feature = "s3", feature = "azure", feature = "gcs", feature = "redis"))]
#[async_trait]

Просмотреть файл

@ -169,7 +169,7 @@ impl Default for DiskCacheConfig {
DiskCacheConfig {
dir: default_disk_cache_dir(),
size: default_disk_cache_size(),
preprocessor_cache_mode: Default::default(),
preprocessor_cache_mode: PreprocessorCacheModeConfig::activated(),
}
}
}
@ -1296,7 +1296,7 @@ token = "webdavtoken"
disk: Some(DiskCacheConfig {
dir: PathBuf::from("/tmp/.cache/sccache"),
size: 7 * 1024 * 1024 * 1024,
preprocessor_cache_mode: Default::default(),
preprocessor_cache_mode: PreprocessorCacheModeConfig::activated(),
}),
gcs: Some(GCSCacheConfig {
bucket: "bucket".to_owned(),