Skip to content
Open
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
7 changes: 6 additions & 1 deletion src/cache/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ use crate::config::Config;
))]
use crate::config::{self, CacheType};
use async_trait::async_trait;
use chrono::Local;
use fs_err as fs;

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

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

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