Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only activate direct mode by default for local #1973

Merged
merged 1 commit into from
Nov 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/Local.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
12 changes: 11 additions & 1 deletion src/cache/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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]
Expand Down
4 changes: 2 additions & 2 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
}
}
}
Expand Down Expand Up @@ -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(),
Expand Down
Loading