Make the hard-coded 60s cache read timeout configurable

Open Beginner friendly
#2,820 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
82/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Active
Tech stack
rust
Domain
devtools

Research direction

Start at src/compiler/compiler.rs around line 590, then compare the related timeout request in issue #2276 for the project's configuration approach. The change is done when the cache read timeout can be set with SCCACHE_CACHE_READ_TIMEOUT_SECS while retaining the current 60-second default.

Written by the indexing model from the issue text.

Description

Summary

The cache read timeout on the compiler path is a hard-coded 60 seconds with no way to configure it.

src/compiler/compiler.rs L590 (v0.17.0, c037e11):

// Set a maximum time limit for the cache to respond before we forge
// ahead ourselves with a compilation.
let timeout = Duration::new(60, 0);

Why it matters

When a storage backend is unhealthy or throttling rather than cleanly failing, every cacheable compilation can wait up to 60 seconds before falling back to local compilation. In a build with thousands of compiler invocations that dominates the build, and the only way to recover is to disable sccache entirely.

This is compounded by non-404 read errors being reported as misses (src/cache/cache.rs L236-L239), which makes a degraded backend hard to distinguish from a cold cache while it is happening.

For CI in particular, a much shorter timeout is usually the right trade: falling back to a local compile after a second or two is far cheaper than waiting a minute per invocation.

Proposal

Expose it as an environment variable, e.g. SCCACHE_CACHE_READ_TIMEOUT_SECS, defaulting to the current 60 so behaviour is unchanged unless set.

Similar in spirit to #2276, which asks for the same treatment of a different hard-coded timeout (REQUEST_TIMEOUT_SECS).

Dominant language
Rust
Stars
7.7k
Forks
748
Avg merge
4d 7h
Merged PRs (30d)
21

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from mozilla/sccache

All issues in mozilla/sccache

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.