Skip to content
Closed
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
Empty file modified .github/actions/nvcc-toolchain/install-cuda.sh
100755 → 100644
Empty file.
Empty file modified scripts/extratest.sh
100755 → 100644
Empty file.
Empty file modified scripts/freebsd-ci-test.sh
100755 → 100644
Empty file.
10 changes: 4 additions & 6 deletions src/cache/disk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,13 +152,11 @@ impl Storage for DiskCache {
self.pool
.spawn_blocking(move || {
let start = Instant::now();
let mut f = lru
.lock()
.unwrap()
.get_or_init()?
.prepare_add(key, data.len() as u64)?;
let mut lru_guard = lru.lock().unwrap();
let cache = lru_guard.get_or_init()?;
let mut f = cache.prepare_add(key, data.len() as u64)?;
f.as_file_mut().write_all(&data)?;
lru.lock().unwrap().get().unwrap().commit(f)?;
cache.commit(f)?;
Ok(start.elapsed())
})
.await?
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ mod mock_command;
mod net;
mod protocol;
pub mod server;
pub mod stats;
#[doc(hidden)]
pub mod util;

Expand Down
14 changes: 6 additions & 8 deletions src/lru_disk_cache/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,7 @@ impl LruDiskCache {
for (file, size) in get_all_files(&self.root) {
if file
.file_name()
.expect("Bad path?")
.starts_with(TEMPFILE_PREFIX)
.map_or(false, |name| name.starts_with(TEMPFILE_PREFIX))
{
fs::remove_file(&file).unwrap_or_else(|e| {
error!("Error removing temporary file `{}`: {}", file.display(), e);
Expand Down Expand Up @@ -220,7 +219,7 @@ impl LruDiskCache {
}
//TODO: ideally LRUCache::insert would give us back the entries it had to remove.
while self.size() + size > self.capacity() {
let (rel_path, _) = self.lru.remove_lru().expect("Unexpectedly empty cache!");
let (rel_path, _) = self.lru.remove_lru().ok_or(Error::FileTooLarge)?;
let remove_path = self.rel_to_abs_path(rel_path);
//TODO: check that files are removable during `init`, so that this is only
// due to outside interference.
Expand Down Expand Up @@ -332,13 +331,12 @@ impl LruDiskCache {
// Ensure we have enough space for the advertized space.
self.make_space(size)?;
let key = key.as_ref().to_owned();
let file = tempfile::Builder::new()
.prefix(TEMPFILE_PREFIX)
.tempfile_in(&self.root)?;
self.pending.push(key.clone());
self.pending_size += size;
tempfile::Builder::new()
.prefix(TEMPFILE_PREFIX)
.tempfile_in(&self.root)
.map(|file| LruDiskCacheAddEntry { file, key, size })
.map_err(Into::into)
Ok(LruDiskCacheAddEntry { file, key, size })
}

/// Commit an entry coming from `LruDiskCache::prepare_add`.
Expand Down
4 changes: 2 additions & 2 deletions src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.SCCACHE_MAX_FRAME_LENGTH
// limitations under the License.

use crate::cache::readonly::ReadOnlyStorage;
use crate::cache::{CacheMode, Storage, storage_from_config};
Expand Down Expand Up @@ -84,7 +84,7 @@ const DIST_CLIENT_RECREATE_TIMEOUT: Duration = Duration::from_secs(30);
pub enum ServerStartup {
/// Server started successfully on `addr`.
Ok { addr: String },
/// Server Addr already in suse
/// Server Addr already in use
AddrInUse,
/// Timed out waiting for server startup.
TimedOut,
Expand Down
Loading
Loading