check / check (push) Failing after 2s
With a fake free-space probe, an empty cache with 4 GiB free gets a 3 GiB default, and the same cache once it holds those 3 GiB, with 1 GiB left free, must keep 3 GiB. The default is still 75% of the free space alone, so the second check fails: this is the bug in #184. computeDefaultMaxBytes only calls the config's existing computation so the test compiles. Model: opus-5-5
18 lines
454 B
Go
18 lines
454 B
Go
package imgcache
|
|
|
|
import (
|
|
"context"
|
|
"path/filepath"
|
|
|
|
"sneak.berlin/go/pixa/internal/config"
|
|
)
|
|
|
|
// computeDefaultMaxBytes returns the default cache size limit for an
|
|
// omitted cache_max_bytes, for the filesystem holding <state_dir>/cache/.
|
|
func (c *Cache) computeDefaultMaxBytes(
|
|
_ context.Context, probe config.FreeSpaceProbeFunc,
|
|
) (int64, error) {
|
|
return config.ComputeDefaultCacheMaxBytes(
|
|
filepath.Join(c.config.StateDir, "cache"), probe)
|
|
}
|