Skip to content

Commit c15ec99

Browse files
committed
feat: Add timestamp to .sccache_check name (#2132)
1 parent 5b1e93e commit c15ec99

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/cache/cache.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ use crate::config::Config;
4343
))]
4444
use crate::config::{self, CacheType};
4545
use async_trait::async_trait;
46+
use chrono::Local;
4647
use fs_err as fs;
4748

4849
use serde::{Deserialize, Serialize};
@@ -490,7 +491,11 @@ impl Storage for opendal::Operator {
490491
async fn check(&self) -> Result<CacheMode> {
491492
use opendal::ErrorKind;
492493

493-
let path = ".sccache_check";
494+
// Use a unique name for path so that we don't have to grant overwrite permissions
495+
// on the bucket.
496+
let formatted_time = Local::now().format("%Y_%m_%d_%H_%M_%S%.3f").to_string();
497+
let combined = format!(".sccache_check_{formatted_time}");
498+
let path: &str = combined.as_str();
494499

495500
// Read is required, return error directly if we can't read .
496501
match self.read(path).await {

0 commit comments

Comments
 (0)