Commit 40d405f318
40d405f318a109aad5e7de7ad71fedcc04bb0e86
parent: 672ff7f44b
Verified · cmc
cmc <hello@cleberg.net> · 2026-07-15 07:23 UTC
fix(cache): correct max-size megabyte conversion
max-size is documented in SETUP.md as megabytes, but the conversion was
`*= 1024 ^ 2`. In Go `^` is XOR, not exponentiation, so this multiplied
by 1026 rather than 1048576 -- a configured max-size of 200 produced a
~205 KB cap instead of 200 MB, wiping the cache almost immediately.
This changes runtime behaviour: the cache will now grow to the size the
config actually asks for.
Layout: unified · split
app/config.go
+3 −1
| @@ -88,7 +88,9 @@ func ExecuteConfig() { |
| 88 | 88 | |
| 89 | 89 | lifetimeParsed = duration * int64(num) |
| 90 | 90 | } |
| 91 | | CFG.Cache.MaxSize *= 1024 ^ 2 |
| 91 | // max-size is documented in megabytes. This was 1024^2, which in Go is |
| 92 | // XOR (1026), not exponentiation — so the cap was ~1000x too small. |
| 93 | CFG.Cache.MaxSize *= 1024 * 1024 |
| 92 | 94 | go InitCacheSystem() |
| 93 | 95 | } |
| 94 | 96 | |